string GetDefaultMessageForErrorType(GameLiftErrorType errorType) { switch (errorType) { case GameLiftErrorType.SERVICE_CALL_FAILED: return("An AWS service call has failed. See the root cause error for more information."); case GameLiftErrorType.LOCAL_CONNECTION_FAILED: return("Connection to local agent could not be established."); case GameLiftErrorType.NETWORK_NOT_INITIALIZED: return("Local network was not initialized. Have you called InitSDK()?"); case GameLiftErrorType.GAMESESSION_ID_NOT_SET: return("No game sessions are bound to this process."); case GameLiftErrorType.TERMINATION_TIME_NOT_SET: return("TerminationTime has not been sent to this process."); case GameLiftErrorType.BAD_REQUEST_EXCEPTION: return("Bad request exception."); case GameLiftErrorType.INTERNAL_SERVICE_EXCEPTION: return("Internal service exception."); default: return("An unexpected error has occurred."); } }
string GetDefaultNameForErrorType(GameLiftErrorType errorType) { switch (errorType) { case GameLiftErrorType.SERVICE_CALL_FAILED: return("Service call failed."); case GameLiftErrorType.LOCAL_CONNECTION_FAILED: return("Local connection failed."); case GameLiftErrorType.NETWORK_NOT_INITIALIZED: return("Network not initialized."); case GameLiftErrorType.GAMESESSION_ID_NOT_SET: return("GameSession id is not set."); case GameLiftErrorType.TERMINATION_TIME_NOT_SET: return("TerminationTime is not set."); case GameLiftErrorType.BAD_REQUEST_EXCEPTION: return("Bad request exception."); case GameLiftErrorType.INTERNAL_SERVICE_EXCEPTION: return("Internal service exception."); default: return("Unknown Error"); } }
public GameLiftError(GameLiftErrorType errorType, string errorName, string errorMessage) { ErrorType = errorType; ErrorName = errorName; ErrorMessage = errorMessage; }
public GameLiftError(GameLiftErrorType errorType) { ErrorType = errorType; ErrorName = GetDefaultNameForErrorType(errorType); ErrorMessage = GetDefaultMessageForErrorType(errorType); }