def toProtocolElement(self): """ Converts this exception into the GA4GH protocol type so that it can be communicated back to the client. """ error = protocol.GAException() error.errorCode = self.getErrorCode() error.message = self.getMessage() return error
def handle_error(exception): if not isinstance(exception, frontendExceptions.FrontendException): if app.config['DEBUG']: print(traceback.format_exc(exception)) exception = frontendExceptions.ServerException() error = protocol.GAException() error.errorCode = exception.code error.message = exception.message response = flask.jsonify(error.toJSONDict()) response.status_code = exception.httpStatus return response
def handleException(exception): exceptionClass = exception.__class__ if exceptionClass in frontendExceptions.exceptionMap: newExceptionClass = frontendExceptions.exceptionMap[exceptionClass] exception = newExceptionClass() if not isinstance(exception, frontendExceptions.FrontendException): if app.config['DEBUG']: print(traceback.format_exc(exception)) exception = frontendExceptions.ServerException() error = protocol.GAException() error.errorCode = exception.code error.message = exception.message response = flask.jsonify(error.toJsonDict()) response.status_code = exception.httpStatus return response