Exceptions

en_core.exceptions

This module provides base classes for most common types of exceptions. Applications should provide their own exception classes by deriving from the most concrete exception provided by this module.

exception InvalidInputError(pname, invalid_value, message=None)

Exception representing an input error. The exception is initialized with the name of the attribute, property, or parameter with the invalid value, and the invalid value that caused the exception. Applications and services can derive from this class to represent more concrete input errors.

Parameters
  • pname (str) – Name of the attribute, property, or parameter for which an invalid value was specified.

  • value (any) – Invalid value specified that caused the exception.

exception RequiredInputError(pname, message=None)

Exception representing and erro from a required attribute, property, or parameter missing from the input. Applications and services can derive from this class to represent more concrete required input errors.

Parameters

pname (str) – Name of the required attribute, property, or parameter that is missing from the input.

exception SerializableError(message)

Base class for all the exceptions. Every exception class provided in applications and libraries most ultimately derived from this class, but best practices recommend to derived from a more concrete exception type.

to_dict()

Overrides the Serializable interface to inject the message property.

Returns

A dictionary representation of the exception.

Return type

dict

exception UnknownError(original_exception, message=None)

This exception wraps another exception when an unknown error is raised. It allows exceptions caused by other libraries for unknown reasons to be wrapped into the Serializable interface. The exception provides the original traceback as part of the data.

Parameters

original_exception (Exception) – The original exception raised.