2014-11-20 13:21:19 +00:00
/ *
* Copyright ( C ) 2013 - 2014 Laurent CLOUET
* Author Laurent CLOUET < laurent . clouet @nopnop.net >
*
2020-05-28 13:28:42 +02:00
* This program is free software ; you can redistribute it and / or
2014-11-20 13:21:19 +00:00
* 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 ;
public class Error {
public enum Type {
2015-03-11 17:55:44 +00:00
// id have to be kept synchronised with the server side.
2020-10-10 10:52:39 +02:00
OK ( 0 ) ,
UNKNOWN ( 99 ) ,
WRONG_CONFIGURATION ( 1 ) ,
AUTHENTICATION_FAILED ( 2 ) ,
TOO_OLD_CLIENT ( 3 ) ,
SESSION_DISABLED ( 4 ) ,
RENDERER_NOT_AVAILABLE ( 5 ) ,
MISSING_RENDERER ( 6 ) ,
MISSING_SCENE ( 7 ) ,
NOOUTPUTFILE ( 8 ) ,
IMAGE_TOO_LARGE ( 26 ) ,
DOWNLOAD_FILE ( 9 ) ,
CAN_NOT_CREATE_DIRECTORY ( 10 ) ,
NETWORK_ISSUE ( 11 ) ,
RENDERER_CRASHED ( 12 ) ,
RENDERER_CRASHED_PYTHON_ERROR ( 24 ) ,
RENDERER_OUT_OF_VIDEO_MEMORY ( 13 ) ,
RENDERER_OUT_OF_MEMORY ( 21 ) ,
RENDERER_KILLED ( 14 ) ,
RENDERER_KILLED_BY_USER ( 20 ) ,
RENDERER_KILLED_BY_USER_OVER_TIME ( 23 ) ,
RENDERER_KILLED_BY_SERVER ( 22 ) ,
RENDERER_MISSING_LIBRARIES ( 15 ) ,
FAILED_TO_EXECUTE ( 16 ) ,
OS_NOT_SUPPORTED ( 17 ) ,
CPU_NOT_SUPPORTED ( 18 ) ,
GPU_NOT_SUPPORTED ( 19 ) ,
2023-11-28 12:28:39 +00:00
GPU_OR_DRIVER_ERROR ( 32 ) ,
2020-12-13 10:46:55 +00:00
ENGINE_NOT_AVAILABLE ( 27 ) ,
2020-10-10 10:52:39 +02:00
VALIDATION_FAILED ( 25 ) ,
2020-10-27 14:42:59 +01:00
IMAGE_WRONG_DIMENSION ( 26 ) ,
2022-05-17 14:05:49 +00:00
CURRENTLY_HEADLESS ( 28 ) ,
2022-04-29 15:52:16 +00:00
DENOISING_NOT_SUPPORTED ( 29 ) ,
2023-01-04 16:24:15 +00:00
CANNOT_READ_FILE ( 30 ) ,
2023-01-13 10:27:01 +01:00
DETECT_DEVICE_ERROR ( 31 ) ,
2023-12-01 12:32:09 +00:00
COLOR_MANAGEMENT_ERROR ( 33 ) ,
2016-05-02 13:26:11 +02:00
2016-09-11 13:46:12 +02:00
// internal error handling
2022-03-13 14:41:11 +01:00
NO_SPACE_LEFT_ON_DEVICE ( 100 ) ,
2022-02-19 01:59:11 +01:00
ERROR_BAD_UPLOAD_RESPONSE ( 101 ) ,
2022-03-13 14:41:11 +01:00
PATH_INVALID ( 102 ) ,
NO_WRITE_PERMISSION ( 103 ) ,
2022-06-09 12:26:38 +00:00
SERVER_DOWN ( 104 ) ,
2022-02-19 02:42:33 +01:00
ERROR_BAD_SERVER_RESPONSE ( 105 ) ,
2016-05-02 13:26:11 +02:00
;
2015-03-11 17:55:44 +00:00
private final int id ;
private Type ( int id ) {
this . id = id ;
}
public int getValue ( ) {
return id ;
}
2015-01-25 18:26:21 +00:00
}
2014-11-20 13:21:19 +00:00
public enum ServerCode {
2020-10-10 10:52:39 +02:00
OK ( 0 ) ,
UNKNOWN ( 999 ) ,
2014-11-20 13:21:19 +00:00
2020-10-10 10:52:39 +02:00
CONFIGURATION_ERROR_NO_CLIENT_VERSION_GIVEN ( 100 ) ,
CONFIGURATION_ERROR_CLIENT_TOO_OLD ( 101 ) ,
CONFIGURATION_ERROR_AUTH_FAILED ( 102 ) ,
CONFIGURATION_ERROR_WEB_SESSION_EXPIRED ( 103 ) ,
CONFIGURATION_ERROR_MISSING_PARAMETER ( 104 ) ,
2014-11-20 13:21:19 +00:00
2020-10-10 10:52:39 +02:00
JOB_REQUEST_NOJOB ( 200 ) ,
JOB_REQUEST_ERROR_NO_RENDERING_RIGHT ( 201 ) ,
JOB_REQUEST_ERROR_DEAD_SESSION ( 202 ) ,
JOB_REQUEST_ERROR_SESSION_DISABLED ( 203 ) ,
2022-07-29 17:13:29 +00:00
JOB_REQUEST_ERROR_SESSION_DISABLED_DENOISING_NOT_SUPPORTED ( 208 ) ,
2020-10-10 10:52:39 +02:00
JOB_REQUEST_ERROR_INTERNAL_ERROR ( 204 ) ,
JOB_REQUEST_ERROR_RENDERER_NOT_AVAILABLE ( 205 ) ,
JOB_REQUEST_SERVER_IN_MAINTENANCE ( 206 ) ,
JOB_REQUEST_SERVER_OVERLOADED ( 207 ) ,
2014-11-20 13:21:19 +00:00
2020-10-10 10:52:39 +02:00
JOB_VALIDATION_ERROR_MISSING_PARAMETER ( 300 ) ,
JOB_VALIDATION_ERROR_BROKEN_MACHINE ( 301 ) , // in GPU the generated frame is black
JOB_VALIDATION_ERROR_FRAME_IS_NOT_IMAGE ( 302 ) ,
JOB_VALIDATION_ERROR_UPLOAD_FAILED ( 303 ) ,
JOB_VALIDATION_ERROR_SESSION_DISABLED ( 304 ) , // missing heartbeat or broken machine
2020-06-21 02:42:20 +10:00
JOB_VALIDATION_IMAGE_TOO_LARGE ( 306 ) ,
2020-10-10 10:52:39 +02:00
JOB_VALIDATION_ERROR_IMAGE_WRONG_DIMENSION ( 308 ) ,
2014-11-20 13:21:19 +00:00
KEEPMEALIVE_STOP_RENDERING ( 400 ) ,
// internal error handling
2022-03-13 14:41:11 +01:00
ERROR_NO_ROOT ( 2 ) ,
ERROR_BAD_RESPONSE ( 3 ) ,
ERROR_REQUEST_FAILED ( 5 ) ,
2022-08-30 18:11:17 +00:00
SERVER_CONNECTION_FAILED ( 6 ) ,
2022-03-13 14:41:11 +01:00
;
2014-11-20 13:21:19 +00:00
private final int id ;
private ServerCode ( int id ) {
this . id = id ;
}
public int getValue ( ) {
return id ;
}
public static ServerCode fromInt ( int val ) {
ServerCode [ ] As = ServerCode . values ( ) ;
2015-01-25 18:36:39 +00:00
for ( ServerCode A : As ) {
if ( A . getValue ( ) = = val ) {
return A ;
2014-11-20 13:21:19 +00:00
}
}
return ServerCode . UNKNOWN ;
}
}
public static Type ServerCodeToType ( ServerCode sc ) {
switch ( sc ) {
case OK :
return Type . OK ;
case UNKNOWN :
return Type . UNKNOWN ;
case CONFIGURATION_ERROR_CLIENT_TOO_OLD :
return Type . TOO_OLD_CLIENT ;
case CONFIGURATION_ERROR_AUTH_FAILED :
return Type . AUTHENTICATION_FAILED ;
2020-05-28 13:28:42 +02:00
2014-11-20 13:21:19 +00:00
case CONFIGURATION_ERROR_NO_CLIENT_VERSION_GIVEN :
2015-05-15 00:13:39 +01:00
case CONFIGURATION_ERROR_WEB_SESSION_EXPIRED :
2014-11-20 13:21:19 +00:00
return Type . WRONG_CONFIGURATION ;
2020-05-28 13:28:42 +02:00
2014-11-20 13:21:19 +00:00
case JOB_REQUEST_ERROR_SESSION_DISABLED :
case JOB_VALIDATION_ERROR_SESSION_DISABLED :
return Type . SESSION_DISABLED ;
2020-05-28 13:28:42 +02:00
2014-12-30 22:06:34 +01:00
case JOB_REQUEST_ERROR_RENDERER_NOT_AVAILABLE :
return Type . RENDERER_NOT_AVAILABLE ;
2014-11-20 13:21:19 +00:00
default :
return Type . UNKNOWN ;
}
}
2014-12-16 23:02:14 +00:00
public static String humanString ( Type in ) {
2014-11-20 13:21:19 +00:00
switch ( in ) {
2022-02-19 01:59:11 +01:00
case ERROR_BAD_UPLOAD_RESPONSE :
2022-03-09 23:34:34 +00:00
return " Corrupt response from the server when trying to upload data. The server might be overloaded or be encountering other issues. Will try again in a few minutes. " ;
2022-02-19 02:42:33 +01:00
case ERROR_BAD_SERVER_RESPONSE :
return " Unexpected response from server received. The server might be overloaded or encountering other issues. " ;
2016-08-30 20:01:26 +02:00
case NETWORK_ISSUE :
2021-12-31 22:00:26 +00:00
return " Could not connect to the server, please check your connection to the internet. " ;
2022-06-09 12:26:38 +00:00
case SERVER_DOWN :
2023-04-07 06:34:48 +00:00
return " The server is down. " ;
2014-11-20 13:21:19 +00:00
case TOO_OLD_CLIENT :
2021-12-31 22:00:26 +00:00
return " This client is too old, you need to update it. " ;
2014-11-20 13:21:19 +00:00
case AUTHENTICATION_FAILED :
2021-12-31 22:00:26 +00:00
return " Failed to authenticate, please check your login and password. " ;
2015-02-04 22:26:37 +00:00
case DOWNLOAD_FILE :
2022-03-09 23:34:34 +00:00
return " Error while downloading the project files. Will try another project in a few minutes. " ;
2014-11-20 13:21:19 +00:00
case NOOUTPUTFILE :
2022-03-09 23:34:34 +00:00
return " The renderer shut down without saving an image. This could be a broken project, or you could be missing libraries that Blender needs. Will try another project in a few minutes. " ;
2020-06-21 02:42:20 +10:00
case IMAGE_TOO_LARGE :
return " The generated image is too big to be handled by the server. Will try another project in a few minutes. " ;
2014-11-20 13:21:19 +00:00
case RENDERER_CRASHED :
2022-03-09 23:34:34 +00:00
return " The renderer has crashed. This is usually because the project consumes too much memory, or is just broken. Will try another project in a few minutes. " ;
2018-07-10 09:59:05 +02:00
case RENDERER_CRASHED_PYTHON_ERROR :
2022-03-09 23:34:34 +00:00
return " The renderer has crashed due to a Python error. Will try another project in a few minutes. " ;
2015-03-10 20:21:50 +00:00
case RENDERER_OUT_OF_VIDEO_MEMORY :
2021-12-31 22:00:26 +00:00
return " Project tried to use too much video memory (VRAM). Will try another project in a few minutes. " ;
2016-08-29 20:07:38 +02:00
case RENDERER_OUT_OF_MEMORY :
2021-12-31 22:00:26 +00:00
return " Project tried to use too much memory. Will try another project in a few minutes. " ;
2015-03-10 20:21:50 +00:00
case GPU_NOT_SUPPORTED :
2023-01-11 14:16:59 +00:00
return " Project's Blender version requires a newer GPU, or your GPU setup is broken. Will try another project in a few minutes. " ;
2014-11-20 13:21:19 +00:00
case RENDERER_MISSING_LIBRARIES :
2021-12-31 22:00:26 +00:00
return " Failed to launch renderer. Please check if you have all the necessary libraries installed and if you have enough free space in your working directory. " ;
2014-12-03 20:09:50 +00:00
case RENDERER_KILLED :
2021-12-31 22:00:26 +00:00
return " Render canceled because either you stopped it from the website or the server did automatically (usually for a render taking too long). " ;
2015-10-27 21:00:44 +00:00
case RENDERER_KILLED_BY_USER :
2021-12-31 22:00:26 +00:00
return " Render canceled because you've blocked the project. " ;
2016-11-01 19:44:09 +01:00
case RENDERER_KILLED_BY_SERVER :
2021-12-31 22:00:26 +00:00
return " Render canceled because the project has been stopped by the server. Usually because the project will take too much time or it's been paused. " ;
2014-11-20 13:21:19 +00:00
case SESSION_DISABLED :
2014-12-23 20:05:29 +01:00
return " The server has disabled your session. Your client may have generated a broken frame (GPU not compatible, not enough RAM/VRAM, etc). " ;
2014-12-30 22:06:34 +01:00
case RENDERER_NOT_AVAILABLE :
2021-12-31 22:00:26 +00:00
return " The official Blender builds don't support rendering on this hardware. " ;
2019-01-28 02:07:22 -06:00
case MISSING_RENDERER :
2022-03-09 23:34:34 +00:00
return " Unable to locate the Blender binaries within the working directory. " ;
2014-12-17 21:47:31 +00:00
case OS_NOT_SUPPORTED :
2023-04-07 06:34:48 +00:00
return " This Operating System is not supported. Please check https://www.blender.org/download/requirements/ for more information. " ;
2014-12-17 21:47:31 +00:00
case CPU_NOT_SUPPORTED :
2022-03-09 23:34:34 +00:00
return " This CPU is not supported. " ;
2022-04-29 15:52:16 +00:00
case DENOISING_NOT_SUPPORTED :
2022-07-29 17:13:29 +00:00
return " Denoising is not supported on this device. Session can not continue. Please use CPU or Virtual Machine with SSE4.1 instruction set. " ;
2020-12-13 10:46:55 +00:00
case ENGINE_NOT_AVAILABLE :
2022-03-09 23:34:34 +00:00
return " The project requires a rendering engine that isn't supported on this machine. Will try another project in a few minutes. " ;
2016-05-02 13:26:11 +02:00
case NO_SPACE_LEFT_ON_DEVICE :
2022-03-11 14:02:22 +00:00
return " Your storage medium does not have enough free space available. " ;
case PATH_INVALID :
return " The working directory path is not valid " ;
case NO_WRITE_PERMISSION :
return " Can't create/modify files due to missing write permissions in working directory. " ;
2020-10-27 14:42:59 +01:00
case IMAGE_WRONG_DIMENSION :
2022-03-09 23:34:34 +00:00
return " The rendered image had the wrong resolution. This project is configured incorrectly. Switching to another project. " ;
2022-05-17 14:05:49 +00:00
case CURRENTLY_HEADLESS :
return " Blender can not open a display to create an OpenGL context needed for EEVEE/GPencil. Will try another project in a few minutes. " ;
2023-01-04 16:24:15 +00:00
case CANNOT_READ_FILE :
return " Blender failed to read the project files. Will try another project in a few minutes. " ;
2023-01-13 10:27:01 +01:00
case DETECT_DEVICE_ERROR :
2023-01-12 16:02:03 +00:00
return " Blender failed to detect the render device. Please check if you have all the necessary libraries installed and if your drivers are up to date. " ;
2023-11-28 12:28:39 +00:00
case GPU_OR_DRIVER_ERROR :
return " There was an error with your GPU or driver. Please ensure you have the latest driver and don't run extreme over/underclockings. " ;
2023-12-01 12:32:09 +00:00
case COLOR_MANAGEMENT_ERROR :
return " There was an error with the Color management. Please ensure you didn't set a weird OCIO config. Or the project might use an unsupported Color management configuration. " ;
2014-11-20 13:21:19 +00:00
default :
return in . toString ( ) ;
}
}
}