Add nice error message when renderer is not available
This commit is contained in:
@@ -34,6 +34,7 @@ import com.sheepit.client.Error.ServerCode;
|
|||||||
import com.sheepit.client.Error.Type;
|
import com.sheepit.client.Error.Type;
|
||||||
import com.sheepit.client.exception.FermeException;
|
import com.sheepit.client.exception.FermeException;
|
||||||
import com.sheepit.client.exception.FermeExceptionBadResponseFromServer;
|
import com.sheepit.client.exception.FermeExceptionBadResponseFromServer;
|
||||||
|
import com.sheepit.client.exception.FermeExceptionNoRendererAvailable;
|
||||||
import com.sheepit.client.exception.FermeExceptionNoRightToRender;
|
import com.sheepit.client.exception.FermeExceptionNoRightToRender;
|
||||||
import com.sheepit.client.exception.FermeExceptionNoSession;
|
import com.sheepit.client.exception.FermeExceptionNoSession;
|
||||||
import com.sheepit.client.exception.FermeExceptionNoSpaceLeftOnDevice;
|
import com.sheepit.client.exception.FermeExceptionNoSpaceLeftOnDevice;
|
||||||
@@ -188,6 +189,17 @@ public class Client {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (FermeExceptionNoRendererAvailable e) {
|
||||||
|
this.gui.error(Error.humanString(Error.Type.RENDERER_NOT_AVAILABLE));
|
||||||
|
// should wait forever to actually display the message to the user
|
||||||
|
while (true) {
|
||||||
|
try {
|
||||||
|
Thread.sleep(100000);
|
||||||
|
}
|
||||||
|
catch (InterruptedException e1) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
catch (FermeExceptionNoSession e) {
|
catch (FermeExceptionNoSession e) {
|
||||||
// User has no session need to re-authenticate
|
// User has no session need to re-authenticate
|
||||||
ret = this.server.getConfiguration();
|
ret = this.server.getConfiguration();
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ import com.sheepit.client.Configuration.ComputeType;
|
|||||||
import com.sheepit.client.Error.ServerCode;
|
import com.sheepit.client.Error.ServerCode;
|
||||||
import com.sheepit.client.exception.FermeException;
|
import com.sheepit.client.exception.FermeException;
|
||||||
import com.sheepit.client.exception.FermeExceptionBadResponseFromServer;
|
import com.sheepit.client.exception.FermeExceptionBadResponseFromServer;
|
||||||
|
import com.sheepit.client.exception.FermeExceptionNoRendererAvailable;
|
||||||
import com.sheepit.client.exception.FermeExceptionNoRightToRender;
|
import com.sheepit.client.exception.FermeExceptionNoRightToRender;
|
||||||
import com.sheepit.client.exception.FermeExceptionNoSession;
|
import com.sheepit.client.exception.FermeExceptionNoSession;
|
||||||
import com.sheepit.client.exception.FermeExceptionNoSpaceLeftOnDevice;
|
import com.sheepit.client.exception.FermeExceptionNoSpaceLeftOnDevice;
|
||||||
@@ -331,6 +332,9 @@ public class Server extends Thread implements HostnameVerifier, X509TrustManager
|
|||||||
else if (ret == ServerCode.JOB_REQUEST_ERROR_DEAD_SESSION) {
|
else if (ret == ServerCode.JOB_REQUEST_ERROR_DEAD_SESSION) {
|
||||||
throw new FermeExceptionNoSession();
|
throw new FermeExceptionNoSession();
|
||||||
}
|
}
|
||||||
|
else if (ret == ServerCode.JOB_REQUEST_ERROR_RENDERER_NOT_AVAILABLE) {
|
||||||
|
throw new FermeExceptionNoRendererAvailable();
|
||||||
|
}
|
||||||
else if (ret == ServerCode.JOB_REQUEST_ERROR_SESSION_DISABLED) {
|
else if (ret == ServerCode.JOB_REQUEST_ERROR_SESSION_DISABLED) {
|
||||||
throw new FermeExceptionSessionDisabled();
|
throw new FermeExceptionSessionDisabled();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2017 Laurent CLOUET
|
||||||
|
* Author Laurent CLOUET <laurent.clouet@nopnop.net>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; version 2
|
||||||
|
* of the License.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.sheepit.client.exception;
|
||||||
|
|
||||||
|
public class FermeExceptionNoRendererAvailable extends FermeException {
|
||||||
|
public FermeExceptionNoRendererAvailable() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public FermeExceptionNoRendererAvailable(String message_) {
|
||||||
|
super(message_);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user