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

@@ -41,7 +41,7 @@ import java.util.stream.Collectors;
import com.sheepit.client.datamodel.SpeedTestTarget;
import com.sheepit.client.datamodel.SpeedTestResult;
import com.sheepit.client.datamodel.SpeedTestTargetResult;
import com.sheepit.client.exception.FermeExceptionSessionDisabledDenoisingNotSupported;
import com.sheepit.client.exception.SheepItExceptionSessionDisabledDenoisingNotSupported;
import com.sheepit.client.hardware.hwid.HWIdentifier;
import com.sheepit.client.os.Windows;
import lombok.Getter;
@@ -68,18 +68,18 @@ import com.sheepit.client.datamodel.JobInfos;
import com.sheepit.client.datamodel.JobValidation;
import com.sheepit.client.datamodel.RequestEndPoint;
import com.sheepit.client.datamodel.ServerConfig;
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.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.SheepItServerDown;
import com.sheepit.client.os.OS;
@@ -311,7 +311,7 @@ public class Server extends Thread {
return Error.Type.OK;
}
public Job requestJob() throws FermeException {
public Job requestJob() throws SheepItException {
this.log.debug("Server::requestJob");
String url_contents = "";
@@ -346,15 +346,15 @@ public class Server extends Thread {
int r = response.code();
if (r == HttpURLConnection.HTTP_UNAVAILABLE || r == HttpURLConnection.HTTP_CLIENT_TIMEOUT) {
this.log.error("Server::requestJob server unavailable or down: " + response);
throw new FermeServerDown();
throw new SheepItServerDown();
}
else if(response.body().contentType().toString().startsWith("text/xml") == false) {
this.log.error("Server::requestJob bad contentType received: " + response);
throw new FermeExceptionBadResponseFromServer();
throw new SheepItExceptionBadResponseFromServer();
}
else if (r != HttpURLConnection.HTTP_OK) {
this.log.error("Server::requestJob unexpected response" + response);
throw new FermeException();
throw new SheepItException();
}
String in = response.body().string();
@@ -376,23 +376,23 @@ public class Server extends Thread {
case JOB_REQUEST_NOJOB:
return null;
case JOB_REQUEST_ERROR_NO_RENDERING_RIGHT:
throw new FermeExceptionNoRightToRender();
throw new SheepItExceptionNoRightToRender();
case JOB_REQUEST_ERROR_DEAD_SESSION:
throw new FermeExceptionNoSession();
throw new SheepItExceptionNoSession();
case JOB_REQUEST_ERROR_SESSION_DISABLED:
throw new FermeExceptionSessionDisabled();
throw new SheepItExceptionSessionDisabled();
case JOB_REQUEST_ERROR_SESSION_DISABLED_DENOISING_NOT_SUPPORTED:
throw new FermeExceptionSessionDisabledDenoisingNotSupported();
throw new SheepItExceptionSessionDisabledDenoisingNotSupported();
case JOB_REQUEST_ERROR_INTERNAL_ERROR:
throw new FermeExceptionBadResponseFromServer();
throw new SheepItExceptionBadResponseFromServer();
case JOB_REQUEST_ERROR_RENDERER_NOT_AVAILABLE:
throw new FermeExceptionNoRendererAvailable();
throw new SheepItExceptionNoRendererAvailable();
case JOB_REQUEST_SERVER_IN_MAINTENANCE:
throw new FermeExceptionServerInMaintenance();
throw new SheepItExceptionServerInMaintenance();
case JOB_REQUEST_SERVER_OVERLOADED:
throw new FermeExceptionServerOverloaded();
throw new SheepItExceptionServerOverloaded();
default:
throw new FermeException("error requestJob: status is not ok (it's " + serverCode + ")");
throw new SheepItException("error requestJob: status is not ok (it's " + serverCode + ")");
}
}
@@ -405,20 +405,20 @@ public class Server extends Thread {
jobData.getRenderTask().getName(), jobData.getRenderTask().getPassword(),
jobData.getRenderTask().getSynchronous_upload().equals("1"), jobData.getRenderTask().getRendererInfos().getUpdate_method());
}
catch (FermeException e) {
catch (SheepItException e) {
throw e;
}
catch (NoRouteToHostException e) {
throw new FermeServerDown();
throw new SheepItServerDown();
}
catch (UnknownHostException e) {
throw new FermeServerDown();
throw new SheepItServerDown();
}
catch (Exception e) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
throw new FermeException("error requestJob: unknown exception " + e + " stacktrace: " + sw.toString());
throw new SheepItException("error requestJob: unknown exception " + e + " stacktrace: " + sw.toString());
}
}
@@ -487,7 +487,7 @@ public class Server extends Thread {
}
}
public Error.Type HTTPGetFile(String url_, String destination_, Gui gui_, String status_) throws FermeException {
public Error.Type HTTPGetFile(String url_, String destination_, Gui gui_, String status_) throws SheepItException {
InputStream is = null;
OutputStream output = null;
@@ -543,13 +543,13 @@ public class Server extends Thread {
catch (Exception e) {
File destFile = new File(destination_);
if (Files.isWritable(destFile.getParentFile().toPath()) == false) {
throw new FermeExceptionNoWritePermission();
throw new SheepItExceptionNoWritePermission();
}
else if (destFile.getParentFile().isDirectory() == false) {
throw new FermeExceptionPathInvalid();
throw new SheepItExceptionPathInvalid();
}
else if (Utils.noFreeSpaceOnDisk(destFile.getParent(), log)) {
throw new FermeExceptionNoSpaceLeftOnDevice();
throw new SheepItExceptionNoSpaceLeftOnDevice();
}
StringWriter sw = new StringWriter();