Ref: proper name of exception

This commit is contained in:
Sheepit Renderfarm
2023-01-28 11:45:20 +00:00
parent a991373bf5
commit 1473d213ca
16 changed files with 131 additions and 131 deletions

View File

@@ -46,19 +46,19 @@ import java.util.concurrent.TimeUnit;
import com.sheepit.client.Error.ServerCode;
import com.sheepit.client.Error.Type;
import com.sheepit.client.exception.FermeException;
import com.sheepit.client.exception.FermeExceptionBadResponseFromServer;
import com.sheepit.client.exception.FermeExceptionNoRendererAvailable;
import com.sheepit.client.exception.FermeExceptionNoRightToRender;
import com.sheepit.client.exception.FermeExceptionNoSession;
import com.sheepit.client.exception.FermeExceptionNoSpaceLeftOnDevice;
import com.sheepit.client.exception.FermeExceptionPathInvalid;
import com.sheepit.client.exception.FermeExceptionNoWritePermission;
import com.sheepit.client.exception.FermeExceptionServerInMaintenance;
import com.sheepit.client.exception.FermeExceptionServerOverloaded;
import com.sheepit.client.exception.FermeExceptionSessionDisabled;
import com.sheepit.client.exception.FermeExceptionSessionDisabledDenoisingNotSupported;
import com.sheepit.client.exception.FermeServerDown;
import com.sheepit.client.exception.SheepItException;
import com.sheepit.client.exception.SheepItExceptionBadResponseFromServer;
import com.sheepit.client.exception.SheepItExceptionNoRendererAvailable;
import com.sheepit.client.exception.SheepItExceptionNoRightToRender;
import com.sheepit.client.exception.SheepItExceptionNoSession;
import com.sheepit.client.exception.SheepItExceptionNoSpaceLeftOnDevice;
import com.sheepit.client.exception.SheepItExceptionPathInvalid;
import com.sheepit.client.exception.SheepItExceptionNoWritePermission;
import com.sheepit.client.exception.SheepItExceptionServerInMaintenance;
import com.sheepit.client.exception.SheepItExceptionServerOverloaded;
import com.sheepit.client.exception.SheepItExceptionSessionDisabled;
import com.sheepit.client.exception.SheepItExceptionSessionDisabledDenoisingNotSupported;
import com.sheepit.client.exception.SheepItServerDown;
import com.sheepit.client.hardware.cpu.CPU;
import com.sheepit.client.hardware.hwid.HWIdentifier;
import com.sheepit.client.os.OS;
@@ -231,11 +231,11 @@ import okhttp3.HttpUrl;
this.gui.status("Requesting Job");
this.renderingJob = this.server.requestJob();
}
catch (FermeExceptionNoRightToRender e) {
catch (SheepItExceptionNoRightToRender e) {
this.gui.error("User does not have enough right to render project");
return -2;
}
catch (FermeExceptionSessionDisabled e) {
catch (SheepItExceptionSessionDisabled e) {
this.gui.error(Error.humanString(Error.Type.SESSION_DISABLED));
// should wait forever to actually display the message to the user
while (shuttingdown == false) {
@@ -246,7 +246,7 @@ import okhttp3.HttpUrl;
}
}
}
catch (FermeExceptionSessionDisabledDenoisingNotSupported e) {
catch (SheepItExceptionSessionDisabledDenoisingNotSupported e) {
this.gui.error(Error.humanString(Error.Type.DENOISING_NOT_SUPPORTED));
// should wait forever to actually display the message to the user
while (shuttingdown == false) {
@@ -257,7 +257,7 @@ import okhttp3.HttpUrl;
}
}
}
catch (FermeExceptionNoRendererAvailable e) {
catch (SheepItExceptionNoRendererAvailable e) {
this.gui.error(Error.humanString(Error.Type.RENDERER_NOT_AVAILABLE));
// should wait forever to actually display the message to the user
while (shuttingdown == false) {
@@ -268,7 +268,7 @@ import okhttp3.HttpUrl;
}
}
}
catch (FermeExceptionNoSession e) {
catch (SheepItExceptionNoSession e) {
this.log.debug("User has no session and needs to re-authenticate");
ret = this.server.getConfiguration();
if (ret != Error.Type.OK) {
@@ -306,12 +306,12 @@ import okhttp3.HttpUrl;
this.gui.status("Requesting Job");
this.renderingJob = this.server.requestJob();
}
catch (FermeException e1) {
catch (SheepItException e1) {
this.renderingJob = null;
}
}
}
catch (FermeServerDown e) {
catch (SheepItServerDown e) {
int wait = ThreadLocalRandom.current().nextInt(10, 30 + 1); // max is exclusive
int time_sleep = 1000 * 60 * wait;
this.gui.status(String.format("Cannot connect to the server. Please check your connectivity. Will try again at %tR",
@@ -329,7 +329,7 @@ import okhttp3.HttpUrl;
this.log.removeCheckPoint(step);
continue; // go back to ask job
}
catch (FermeExceptionServerOverloaded e) {
catch (SheepItExceptionServerOverloaded e) {
int wait = ThreadLocalRandom.current().nextInt(10, 30 + 1); // max is exclusive
int time_sleep = 1000 * 60 * wait;
this.gui.status(String.format("The server is overloaded and cannot allocate a job. Will try again at %tR",
@@ -347,7 +347,7 @@ import okhttp3.HttpUrl;
this.log.removeCheckPoint(step);
continue; // go back to ask job
}
catch (FermeExceptionServerInMaintenance e) {
catch (SheepItExceptionServerInMaintenance e) {
int wait = ThreadLocalRandom.current().nextInt(20, 30 + 1); // max is exclusive
int time_sleep = 1000 * 60 * wait;
this.gui.status(String.format("The server is under maintenance and cannot allocate a job. Will try again at %tR",
@@ -365,7 +365,7 @@ import okhttp3.HttpUrl;
this.log.removeCheckPoint(step);
continue; // go back to ask job
}
catch (FermeExceptionBadResponseFromServer e) {
catch (SheepItExceptionBadResponseFromServer e) {
int wait = ThreadLocalRandom.current().nextInt(15, 30 + 1); // max is exclusive
int time_sleep = 1000 * 60 * wait;
this.gui.status(String.format("Bad answer from the server. Will try again at %tR", new Date(new Date().getTime() + time_sleep)));
@@ -382,7 +382,7 @@ import okhttp3.HttpUrl;
this.log.removeCheckPoint(step);
continue; // go back to ask job
}
catch (FermeException e) {
catch (SheepItException e) {
this.gui.error("Client::run exception requestJob (1) " + e.getMessage());
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
@@ -786,18 +786,18 @@ import okhttp3.HttpUrl;
return Error.Type.CAN_NOT_CREATE_DIRECTORY;
}
}
catch (FermeException e) {
catch (SheepItException e) {
gui.setRenderingProjectName("");
for (String logline : configuration.filesystemHealthCheck()) {
log.debug(logline);
}
if (e instanceof FermeExceptionNoSpaceLeftOnDevice) {
if (e instanceof SheepItExceptionNoSpaceLeftOnDevice) {
return Error.Type.NO_SPACE_LEFT_ON_DEVICE;
}
else if (e instanceof FermeExceptionPathInvalid) {
else if (e instanceof SheepItExceptionPathInvalid) {
return Error.Type.PATH_INVALID;
}
else if (e instanceof FermeExceptionNoWritePermission) {
else if (e instanceof SheepItExceptionNoWritePermission) {
return Error.Type.NO_WRITE_PERMISSION;
}
else {
@@ -857,17 +857,17 @@ import okhttp3.HttpUrl;
return Error.Type.OK;
}
protected Error.Type downloadSceneFile(Job ajob_) throws FermeException {
protected Error.Type downloadSceneFile(Job ajob_) throws SheepItException {
return this.downloadFile(ajob_, ajob_.getRequiredSceneArchivePath(), ajob_.getSceneMD5(),
String.format(LOCALE, "%s?type=job&job=%s", this.server.getPage("download-archive"), ajob_.getId()), "project");
}
protected Error.Type downloadExecutable(Job ajob) throws FermeException {
protected Error.Type downloadExecutable(Job ajob) throws SheepItException {
return this.downloadFile(ajob, ajob.getRequiredRendererArchivePath(), ajob.getRendererMD5(),
String.format(LOCALE, "%s?type=binary&job=%s", this.server.getPage("download-archive"), ajob.getId()), "renderer");
}
private Error.Type downloadFile(Job ajob, String local_path, String md5_server, String url, String download_type) throws FermeException {
private Error.Type downloadFile(Job ajob, String local_path, String md5_server, String url, String download_type) throws SheepItException {
File local_path_file = new File(local_path);
String update_ui = "Downloading " + download_type;