6. dxpy.exceptions Module

Exceptions for the dxpy package.

exception dxpy.exceptions.AppError[source]

Bases: dxpy.exceptions.ProgramError

Base class for fatal exceptions to be raised while using dxpy inside 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: dxpy.exceptions.DXError

Base class for fatal exceptions to be raised while using dxpy inside 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.json in the current working directory, allowing reporting of the error state through the DNAnexus API.

exception dxpy.exceptions.BadJSONInReply[source]

Bases: exceptions.ValueError

Raised 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.ContentLengthError(*args, **kwargs)[source]

Bases: requests.exceptions.HTTPError

Raised when actual content length received from the server does not match the “Content-Length” header

Initialize RequestException with request and response objects.

exception dxpy.exceptions.DXAPIError(content, code, timestamp=u'', req_id=u'')[source]

Bases: dxpy.exceptions.DXError

Exception for when the API server responds with a code that is not 200 (OK). See https://wiki.dnanexus.com/API-Specification-v1.0.0/Protocols#Errors for complete documentation of API errors, including those reflected by subclasses of this class.

error_message()[source]

Returns a one-line description of the error.

exception dxpy.exceptions.DXAppletError[source]

Bases: dxpy.exceptions.DXError

Exception for dxpy.bindings.dxapplet.DXApplet.

exception dxpy.exceptions.DXCLIError[source]

Bases: dxpy.exceptions.DXError

Exception class for generic errors in the command-line client

exception dxpy.exceptions.DXChecksumMismatchError[source]

Bases: dxpy.exceptions.DXFileError

Exception raised by dxpy.bindings.dxfile.DXFile on checksum mismatch.

exception dxpy.exceptions.DXError[source]

Bases: exceptions.Exception

Base class for exceptions in this package.

exception dxpy.exceptions.DXFileError[source]

Bases: dxpy.exceptions.DXError

Exception for dxpy.bindings.dxfile.DXFile.

exception dxpy.exceptions.DXGTableError[source]

Bases: dxpy.exceptions.DXError

Exception for dxpy.bindings.dxgtable.DXGTable.

exception dxpy.exceptions.DXIncompleteReadsError[source]

Bases: dxpy.exceptions.DXError

Exception for dxpy.bindings.dxfile.DXFile when returned read data is shorter than requested

exception dxpy.exceptions.DXJobFailureError[source]

Bases: dxpy.exceptions.DXError

Exception produced by dxpy.bindings.dxjob.DXJob when a job fails.

exception dxpy.exceptions.DXPartLengthMismatchError[source]

Bases: dxpy.exceptions.DXFileError

Exception raised by dxpy.bindings.dxfile.DXFile on part length mismatch.

exception dxpy.exceptions.DXSearchError[source]

Bases: dxpy.exceptions.DXError

Exception for dxpy.bindings.search methods.

exception dxpy.exceptions.InternalError(content, code, timestamp=u'', req_id=u'')[source]

Bases: dxpy.exceptions.DXAPIError

Raised when the server encountered an internal error.

exception dxpy.exceptions.InvalidAuthentication(content, code, timestamp=u'', req_id=u'')[source]

Bases: dxpy.exceptions.DXAPIError

Raised when the provided OAuth2 token is invalid.

exception dxpy.exceptions.InvalidInput(content, code, timestamp=u'', req_id=u'')[source]

Bases: dxpy.exceptions.DXAPIError

Raised 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=u'', req_id=u'')[source]

Bases: dxpy.exceptions.DXAPIError

Raised when the operation is not allowed at this object state.

exception dxpy.exceptions.InvalidType(content, code, timestamp=u'', req_id=u'')[source]

Bases: dxpy.exceptions.DXAPIError

Raised when an object specified in the request is of invalid type.

exception dxpy.exceptions.MalformedJSON(content, code, timestamp=u'', req_id=u'')[source]

Bases: dxpy.exceptions.DXAPIError

Raised when the input could not be parsed as JSON.

exception dxpy.exceptions.PermissionDenied(content, code, timestamp=u'', req_id=u'')[source]

Bases: dxpy.exceptions.DXAPIError

Raised when the supplied credentials have insufficient permissions to perform this action.

exception dxpy.exceptions.ProgramError[source]

Bases: dxpy.exceptions.DXError

Deprecated. Use AppError instead.

exception dxpy.exceptions.RateLimitConditional(content, code, timestamp=u'', req_id=u'')[source]

Bases: dxpy.exceptions.DXAPIError

Raised when the rate of invalid requests is too high.

exception dxpy.exceptions.ResourceNotFound(content, code, timestamp=u'', req_id=u'')[source]

Bases: dxpy.exceptions.DXAPIError

Raised when a specified entity or resource could not be found.

exception dxpy.exceptions.ServiceUnavailable(content, code, timestamp=u'', req_id=u'')[source]

Bases: dxpy.exceptions.DXAPIError

Raised when an API service was temporarily unavailable.

exception dxpy.exceptions.SpendingLimitExceeded(content, code, timestamp=u'', req_id=u'')[source]

Bases: dxpy.exceptions.DXAPIError

Raised when the spending limit has been reached for the account that would be billed for this action.

exception dxpy.exceptions.UrllibInternalError[source]

Bases: exceptions.AttributeError

Exception class for AttributeError from urllib3

dxpy.exceptions.err_exit(message=u'', code=None, expected_exceptions=(<class 'requests.packages.urllib3.exceptions.ProtocolError'>, <class 'requests.packages.urllib3.exceptions.DecodeError'>, <class 'requests.packages.urllib3.exceptions.ConnectTimeoutError'>, <class 'requests.packages.urllib3.exceptions.ReadTimeoutError'>, <class 'httplib.HTTPException'>, <class 'requests.exceptions.HTTPError'>, <class 'socket.error'>, <class 'dxpy.exceptions.DXAPIError'>, <class 'dxpy.exceptions.DXCLIError'>, <type 'exceptions.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
dxpy.exceptions.exit_with_exc_info(code=1, message=u'', 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.format_exception(e)[source]

Returns a string containing the type and text of the exception.

Previous topic

5. dxpy.api Module

This Page