icat.exception — Exception handling

This module defines Python counterparts of the exceptions raised by ICAT or IDS server, as well as exceptions raised in python-icat.

Helper

exception icat.exception._BaseException(*args)

Bases: Exception

An exception that tries to suppress misleading context.

Exception Chaining and Embedded Tracebacks has been introduced with Python 3. Unfortunately the result is completely misleading most of the times. This class tries to strip the context from the exception traceback.

This is the common base class for for all exceptions defined in icat.exception, it is not intented to be raised directly.

Exceptions raised by the ICAT or IDS server

exception icat.exception.ServerError(error, status=None)

Bases: _BaseException

Errors raised by either the ICAT or the IDS server.

This is the common base class for icat.exception.ICATError and icat.exception.IDSError, it is not intented to be raised directly.

exception icat.exception.ICATError(error, status=None)

Bases: ServerError

Base class for the errors raised by the ICAT server.

exception icat.exception.ICATParameterError(error, status=None)

Bases: ICATError

Generally indicates a problem with the arguments made to a call.

exception icat.exception.ICATInternalError(error, status=None)

Bases: ICATError

May be caused by network problems, database problems, GlassFish problems or bugs in ICAT.

exception icat.exception.ICATPrivilegesError(error, status=None)

Bases: ICATError

Indicates that the authorization rules have not matched your request.

exception icat.exception.ICATNoObjectError(error, status=None)

Bases: ICATError

Is thrown when something is not found.

exception icat.exception.ICATObjectExistsError(error, status=None)

Bases: ICATError

Is thrown when trying to create something but there is already one with the same values of the constraint fields.

exception icat.exception.ICATSessionError(error, status=None)

Bases: ICATError

Is used when the sessionId you have passed into a call is not valid or if you are unable to authenticate.

exception icat.exception.ICATValidationError(error, status=None)

Bases: ICATError

Marks an exception which was thrown instead of placing the database in an invalid state.

exception icat.exception.ICATNotImplementedError(error, status=None)

Bases: ICATError

exception icat.exception.IDSError(error, status=None)

Bases: ServerError

Base class for the errors raised by the IDS server.

exception icat.exception.IDSBadRequestError(error, status=None)

Bases: IDSError

Any kind of bad input parameter.

exception icat.exception.IDSDataNotOnlineError(error, status=None)

Bases: IDSError

The requested data are not on line.

exception icat.exception.IDSInsufficientPrivilegesError(error, status=None)

Bases: IDSError

You are denied access to the data.

exception icat.exception.IDSInsufficientStorageError(error, status=None)

Bases: IDSError

There is not sufficient physical storage or you have exceeded some quota.

exception icat.exception.IDSInternalError(error, status=None)

Bases: IDSError

Some kind of failure in the server or in communicating with the server.

exception icat.exception.IDSNotFoundError(error, status=None)

Bases: IDSError

The requested data do not exist.

exception icat.exception.IDSNotImplementedError(error, status=None)

Bases: IDSError

Use of some functionality that is not supported by the implementation.

icat.exception.translateError(error, status=None, server='ICAT')

Translate an error from ICAT or IDS to the corresponding exception.

Exceptions raised by python-icat

exception icat.exception.InternalError(*args)

Bases: _BaseException

An error that reveals a bug in python-icat.

exception icat.exception.ConfigError(*args)

Bases: _BaseException

Error getting configuration options.

exception icat.exception.QueryWarning

Bases: Warning

Warning while building a query.

New in version 0.19.0.

exception icat.exception.QueryNullableOrderWarning(attr)

Bases: QueryWarning

Warn about using a nullable many to one relation for ordering.

Changed in version 0.19.0: inherit from QueryWarning.

exception icat.exception.QueryOneToManyOrderWarning(attr)

Bases: QueryWarning

Warn about using a one to many relation for ordering.

New in version 0.19.0.

exception icat.exception.ClientVersionWarning(version=None, comment=None)

Bases: Warning

Warn that the version of the ICAT server is not supported by the client.

exception icat.exception.ICATDeprecationWarning(feature, version=None)

Bases: DeprecationWarning

Warn about using an API feature that may get removed in future ICAT server versions.

exception icat.exception.EntityTypeError(*args)

Bases: _BaseException, TypeError

An invalid entity type has been used.

Changed in version 0.18.0: inherit from TypeError.

exception icat.exception.VersionMethodError(method, version=None, service='ICAT')

Bases: _BaseException

Call of an API method that is not supported in the version of the server.

exception icat.exception.SearchResultError(*args)

Bases: _BaseException

A search result does not conform to what should have been expected.

exception icat.exception.SearchAssertionError(query, assertmin, assertmax, num)

Bases: SearchResultError

A search result does not conform to an assertion.

This exception is thrown when the number of objects found on a search does not lie within the bounds of an assertion, see icat.client.Client.assertedSearch().

exception icat.exception.DataConsistencyError(*args)

Bases: _BaseException

Some data is not consistent with rules or constraints.

exception icat.exception.IDSResponseError(*args)

Bases: _BaseException

The response from the IDS was not what should have been expected.

exception icat.exception.InvalidIngestFileError(detail=None)

Bases: _BaseException, ValueError

The content of the file is not valid ingest format.

New in version 1.1.0.

Exception hierarchy

The class hierarchy for the exceptions is:

Exception
 ├── ServerError
 │    ├── ICATError
 │    │    ├── ICATParameterError
 │    │    ├── ICATInternalError
 │    │    ├── ICATPrivilegesError
 │    │    ├── ICATNoObjectError
 │    │    ├── ICATObjectExistsError
 │    │    ├── ICATSessionError
 │    │    ├── ICATValidationError
 │    │    └── ICATNotImplementedError
 │    └── IDSError
 │         ├── IDSBadRequestError
 │         ├── IDSDataNotOnlineError
 │         ├── IDSInsufficientPrivilegesError
 │         ├── IDSInsufficientStorageError
 │         ├── IDSInternalError
 │         ├── IDSNotFoundError
 │         └── IDSNotImplementedError
 ├── InternalError
 ├── ConfigError
 ├── TypeError
 │    └── EntityTypeError
 ├── VersionMethodError
 ├── SearchResultError
 │    └── SearchAssertionError
 ├── DataConsistencyError
 ├── IDSResponseError
 ├── ValueError
 │    └── InvalidIngestFileError
 └── Warning
      ├── QueryWarning
      │    ├── QueryNullableOrderWarning
      │    └── QueryOneToManyOrderWarning
      ├── ClientVersionWarning
      └── DeprecationWarning
           └── ICATDeprecationWarning

Here, Exception, TypeError, Warning, and DeprecationWarning are build-in exceptions from the Python standard library.