5. dxpy.exceptions Module¶
Exceptions for the dxpy package.
- exception dxpy.exceptions.DXError[source]¶
Bases:
ExceptionBase class for exceptions in this package.
- exception dxpy.exceptions.DXAPIError(content, code, timestamp='', req_id='')[source]¶
Bases:
DXErrorException for when the API server responds with a code that is not 200 (OK). See https://documentation.dnanexus.com/developer/api/protocols#errors for complete documentation of API errors, including those reflected by subclasses of this class.
- exception dxpy.exceptions.MalformedJSON(content, code, timestamp='', req_id='')[source]¶
Bases:
DXAPIErrorRaised when the input could not be parsed as JSON.
- exception dxpy.exceptions.InvalidAuthentication(content, code, timestamp='', req_id='')[source]¶
Bases:
DXAPIErrorRaised when the provided OAuth2 token is invalid.
- exception dxpy.exceptions.PermissionDenied(content, code, timestamp='', req_id='')[source]¶
Bases:
DXAPIErrorRaised when the supplied credentials have insufficient permissions to perform this action.
- exception dxpy.exceptions.SpendingLimitExceeded(content, code, timestamp='', req_id='')[source]¶
Bases:
DXAPIErrorRaised when the spending limit has been reached for the account that would be billed for this action.
- exception dxpy.exceptions.ResourceNotFound(content, code, timestamp='', req_id='')[source]¶
Bases:
DXAPIErrorRaised when a specified entity or resource could not be found.
- exception dxpy.exceptions.InvalidInput(content, code, timestamp='', req_id='')[source]¶
Bases:
DXAPIErrorRaised when the input is syntactically correct (JSON), but semantically incorrect (for example, a JSON array is provided where a hash was required; or a required parameter was missing, etc.).
- exception dxpy.exceptions.InvalidState(content, code, timestamp='', req_id='')[source]¶
Bases:
DXAPIErrorRaised when the operation is not allowed at this object state.
- exception dxpy.exceptions.InvalidType(content, code, timestamp='', req_id='')[source]¶
Bases:
DXAPIErrorRaised when an object specified in the request is of invalid type.
- exception dxpy.exceptions.RateLimitConditional(content, code, timestamp='', req_id='')[source]¶
Bases:
DXAPIErrorRaised when the rate of invalid requests is too high.
- exception dxpy.exceptions.InternalError(content, code, timestamp='', req_id='')[source]¶
Bases:
DXAPIErrorRaised when the server encountered an internal error.
Bases:
DXAPIErrorRaised when an API service was temporarily unavailable.
- exception dxpy.exceptions.DXFileError[source]¶
Bases:
DXErrorException for
dxpy.bindings.dxfile.DXFile.
- exception dxpy.exceptions.DXIncompleteReadsError[source]¶
Bases:
DXErrorException for
dxpy.bindings.dxfile.DXFilewhen returned read data is shorter than requested
- exception dxpy.exceptions.DXPartLengthMismatchError[source]¶
Bases:
DXFileErrorException raised by
dxpy.bindings.dxfile.DXFileon part length mismatch.
- exception dxpy.exceptions.DXChecksumMismatchError[source]¶
Bases:
DXFileErrorException raised by
dxpy.bindings.dxfile.DXFileon checksum mismatch.
- exception dxpy.exceptions.DXSearchError[source]¶
Bases:
DXErrorException for
dxpy.bindings.searchmethods.
- exception dxpy.exceptions.DXAppletError[source]¶
Bases:
DXErrorException for
dxpy.bindings.dxapplet.DXApplet.
- exception dxpy.exceptions.DXJobFailureError[source]¶
Bases:
DXErrorException produced by
dxpy.bindings.dxjob.DXJobwhen a job fails.
- exception dxpy.exceptions.AppError[source]¶
Bases:
ProgramErrorBase class for fatal exceptions to be raised while using
dxpyinside DNAnexus execution containers.This exception is thrown for user errors, and the error message is presented to the user. Throwing this exception will cause the Python execution template to write exception information into the file job_error.json in the current working directory, allowing reporting of the error state through the DNAnexus API.
- exception dxpy.exceptions.AppInternalError[source]¶
Bases:
DXErrorBase class for fatal exceptions to be raised while using
dxpyinside DNAnexus execution containers.This exception is intended for internal App errors, whose message goes to the App developer. Throwing this exception will cause the Python execution template to write exception information into the file
job_error.jsonin the current working directory, allowing reporting of the error state through the DNAnexus API.
- exception dxpy.exceptions.DXCLIError[source]¶
Bases:
DXErrorException class for generic errors in the command-line client
- exception dxpy.exceptions.ContentLengthError[source]¶
Bases:
HTTPErrorRaised when actual content length received from the server does not match the “Content-Length” header
- exception dxpy.exceptions.HTTPErrorWithContent(value, content)[source]¶
Bases:
HTTPErrorSpecific variant of HTTPError with response content.
This class was created to avoid appending content directly to error message which makes difficult to format log strings.
- exception dxpy.exceptions.BadJSONInReply[source]¶
Bases:
ValueErrorRaised when the server returned invalid JSON in the response body. Possible reasons for this are the network connection breaking, or overload on the server.
- exception dxpy.exceptions.InvalidTLSProtocol[source]¶
Bases:
DXAPIErrorRaised when the connection to the server was reset due to an ssl protocol not supported. Only connections with TLS v1.2 will be accepted.
- exception dxpy.exceptions.UrllibInternalError[source]¶
Bases:
AttributeErrorException class for AttributeError from urllib3
- dxpy.exceptions.format_exception(e)[source]¶
Returns a string containing the type and text of the exception.
- dxpy.exceptions.exit_with_exc_info(code=1, message='', print_tb=False, exception=None)[source]¶
Exits the program, printing information about the last exception (if any) and an optional error message. Uses exception instead if provided.
- Parameters:
code (integer (valid exit code, 0-255)) – Exit code.
message (string) – Message to be printed after the exception information.
print_tb (boolean) – If set to True, prints the exception traceback; otherwise, suppresses it.
- dxpy.exceptions.err_exit(message='', code=None, expected_exceptions=(<class 'urllib3.exceptions.ProtocolError'>, <class 'urllib3.exceptions.NewConnectionError'>, <class 'urllib3.exceptions.DecodeError'>, <class 'urllib3.exceptions.ConnectTimeoutError'>, <class 'urllib3.exceptions.ReadTimeoutError'>, <class 'http.client.HTTPException'>, <class 'urllib3.exceptions.SSLError'>, <class 'ssl.SSLError'>, <class 'urllib3.exceptions.HTTPError'>, <class 'OSError'>, <class 'ConnectionResetError'>, <class 'json.decoder.JSONDecodeError'>, <class 'dxpy.exceptions.DXAPIError'>, <class 'dxpy.exceptions.DXCLIError'>, <class 'KeyboardInterrupt'>), arg_parser=None, ignore_sigpipe=True, exception=None)[source]¶
Exits the program, printing information about the last exception (if any) and an optional error message. Uses exception instead if provided.
Uses expected_exceptions to set the error code decide whether to suppress the error traceback.
- Parameters:
message (string) – Message to be printed after the exception information.
code (integer (valid exit code, 0-255)) – Exit code.
expected_exceptions (iterable) – Exceptions for which to exit with error code 3 (expected error condition) and suppress the stack trace (unless the _DX_DEBUG environment variable is set).
arg_parser – argparse.ArgumentParser object used in the program (optional)
ignore_sigpipe (boolean) – Whether to exit silently with code 3 when IOError with code EPIPE is raised. Default true.
exception – an exception to use in place of the last exception raised