3.6. Exception Handling

Todo

Intro to SAGA exception handling.

3.6.1. Exceptions – saga.exceptions

exception saga.exceptions.SagaException(msg, parent=None, api_object=None, from_log=False)[source]

Bases: exceptions.Exception

The Exception class encapsulates information about error conditions encountered in SAGA.

Additionally to the error message (e.message), the exception also provides a trace to the code location where the error condition got raised (e.traceback).

B{Example}:

try :
    file = saga.filesystem.File ("sftp://alamo.futuregrid.org/tmp/data1.dat")

except saga.Timeout as to :
    # maybe the network is down?
    print "connection timed out"
except saga.Exception as e :
    # something else went wrong
    print "Exception occurred: %s %s" % (e, e.traceback)

There are cases where multiple backends can report errors at the same time. In that case, the saga-python implementation will collect the exceptions, sort them by their ‘rank’, and return the highest ranked one. All other catched exceptions are available via get_all_exceptions(), or via the exceptions property.

The rank of an exception defines its explicity: in general terms: the higher the rank, the better defined / known is the cause of the problem.

get_message()[source]

Return the exception message as a string. That message is also available via the ‘message’ property.

get_type()[source]

Return the type of the exception as string.

get_object()[source]

Return the object that raised this exception. An object may not always be available – for example, exceptions raised during object creation may not have the option to keep an incomplete object instance around. In those cases, this method will return ‘None’. Either way, the object is also accessible via the ‘object’ property.

get_all_exceptions()[source]
get_all_messages()[source]
get_traceback()[source]
message

Return the exception message as a string. That message is also available via the ‘message’ property.

object

Return the object that raised this exception. An object may not always be available – for example, exceptions raised during object creation may not have the option to keep an incomplete object instance around. In those cases, this method will return ‘None’. Either way, the object is also accessible via the ‘object’ property.

type

Return the type of the exception as string.

exceptions
messages
traceback
exception saga.exceptions.NotImplemented(msg, parent=None, api_object=None, from_log=False)[source]

Bases: saga.exceptions.SagaException

SAGA-Python does not implement this method or class. (rank: 11)

exception saga.exceptions.IncorrectURL(msg, parent=None, api_object=None, from_log=False)[source]

Bases: saga.exceptions.SagaException

The given URL could not be interpreted, for example due to an incorrect / unknown schema. (rank: 10)

exception saga.exceptions.BadParameter(msg, parent=None, api_object=None, from_log=False)[source]

Bases: saga.exceptions.SagaException

A given parameter is out of bound or ill formatted. (rank: 9)

exception saga.exceptions.AlreadyExists(msg, parent=None, api_object=None, from_log=False)[source]

Bases: saga.exceptions.SagaException

The entity to be created already exists. (rank: 8)

exception saga.exceptions.DoesNotExist(msg, parent=None, api_object=None, from_log=False)[source]

Bases: saga.exceptions.SagaException

An operation tried to access a non-existing entity. (rank: 7)

exception saga.exceptions.IncorrectState(msg, parent=None, api_object=None, from_log=False)[source]

Bases: saga.exceptions.SagaException

The operation is not allowed on the entity in its current state. (rank: 6)

exception saga.exceptions.PermissionDenied(msg, parent=None, api_object=None, from_log=False)[source]

Bases: saga.exceptions.SagaException

The used identity is not permitted to perform the requested operation. (rank: 5)

exception saga.exceptions.AuthorizationFailed(msg, parent=None, api_object=None, from_log=False)[source]

Bases: saga.exceptions.SagaException

The backend could not establish a valid identity. (rank: 4)

exception saga.exceptions.AuthenticationFailed(msg, parent=None, api_object=None, from_log=False)[source]

Bases: saga.exceptions.SagaException

The backend could not establish a valid identity. (rank: 3)

exception saga.exceptions.Timeout(msg, parent=None, api_object=None, from_log=False)[source]

Bases: saga.exceptions.SagaException

The interaction with the backend times out. (rank: 2)

exception saga.exceptions.NoSuccess(msg, parent=None, api_object=None, from_log=False)[source]

Bases: saga.exceptions.SagaException

Some other error occurred. (rank: 1)