OEErrorHandler

class OEErrorHandler

This class represents OEErrorHandler.

The OEErrorHandler class is used to define the behavior of the OEThrow error handler. All diagnostic output, including error, warning and informational messages, generated by the OpenEye libraries are emitted via OEThrow. The OEErrorHandler class defines how these messages are emitted, but also how the user can redirect and/or intercept these messages.

Constructors

OEErrorHandler() -> OEErrorHandler

Default constructor that creates an OEErrorHandlerImplBase that it owns and writes output to stderr.

OEErrorHandler(rhs: OEErrorHandler) -> OEErrorHandler

Copy constructor.

Note

OEErrorHandlerImplBase.CreateCopy will only be called by the copy constructor if the right-hand-side owns the OEErrorHandlerImplBase. This is why the right-hand-side argument is non-const.

Clear

Clear() -> None

Reset all the counts returned by OEErrorHandler.Count to zero.

Count

Count(level: int = 0) -> int

Returns the number of messages already written at the given level. The constant level should be drawn from the OEErrorLevel namespace. If level is zero, the default, the sum of all error level counts is returned.

Debug

Debug(arg2: str) -> None

Writes debugging messages to the OEErrorHandler. By default, these message will not appear, OEErrorHandler.SetLevel should be set to OEErrorLevel_Debug or below to make them appear.

Error

Error(arg2: str) -> None

Writes error messages to the OEErrorHandler. Depending upon the value of the OEErrorHandler’s ‘strict’ property (see OEErrorHandler.GetStrict and OEErrorHandler.SetStrict), these diagnostics are forwarded to either the OEErrorHandler.Fatal or OEErrorHandler.Warning methods.

Fatal

Fatal(arg2: str) -> None

Writes fatal error messages to the OEErrorHandler.

GetHandlerImpl

GetHandlerImpl() -> OEErrorHandlerImplBase

Returns the OEErrorHandlerImplBase error handler that is used to handle messages. The default error handler writes output to stderr. The error handler can be changed by calling the OEErrorHandler.SetHandlerImpl method.

GetLevel

GetLevel() -> int

Returns a constant from the OEErrorLevel namespace indicating the current level of messages that should make it to the output stream. The default is OEErrorLevel_Default, that will output messages of OEErrorHandler.Info or higher.

Warning

All threads, including the main thread, will start out at the OEErrorLevel_Default level. OEErrorHandler.SetLevel will only change the level for the current thread.

GetStrict

GetStrict() -> bool

Returns the ‘strict’ property of the OEErrorHandler. When the OEErrorHandler is strict, all error messages written via the OEErrorHandler.Error methods are treated as fatal, and handled like those passed to OEErrorHandler.Fatal. When the OEErrorHandler is not strict, error messages written via OEErrorHandler.Error are treated like those to OEErrorHandler.Warning. The strict property of an OEErrorHandler can be set using the OEErrorHandler.SetStrict method.

Info

Info(arg2: str) -> None

Writes an informational messages to the OEErrorHandler.

Msg

Msg(level: int, arg3: str) -> None

Write a message at any level. The level constant should be drawn from the OEErrorLevel namespace.

SetHandlerImpl

SetHandlerImpl(ptr: OEErrorHandlerImplBase, owned: bool) -> None

Use a different implementation of OEErrorHandlerImplBase to handle error messages. The ownership is determined by the owned flag, which is always false in any other language but C++.

This method allows a user to completely redefine how the OpenEye toolkits handle error messages by declaring a new subclass of OEErrorHandlerImplBase and defining the OEErrorHandlerImplBase.Msg to have the desired behavior.

SetLevel

SetLevel(errLevel: int) -> None

Controls whether a message passed to the error handler will make it to the output stream. Values greater than errLevel from the OEErrorLevel namespace will be sent to the output stream.

Warning

This method will only change the error level for the current thread. Child threads will not inherit the parent thread error level.

SetOutputStream

SetOutputStream(ofs: oeostream) -> None

Sets the output stream (oeostream) that diagnostic messages are written to when no custom error handler has been specified. By default, all messages are written to OEPlatform_oeerr. This function can be used to redirect this output to either a file stream (oeofstream) or a string stream (oeosstream).

SetStrict

SetStrict(strict: bool) -> None

Sets the ‘strict’ property of the OEErrorHandler. When the OEErrorHandler is strict, all error messages written via the OEErrorHandler.Error methods are treated as fatal, and handled like those passed to OEErrorHandler.Fatal. When the OEErrorHandler is not strict, error messages written via OEErrorHandler.Error are treated like those to OEErrorHandler.Warning. The strict property of an OEErrorHandler can be retrieved by using the OEErrorHandler.GetStrict method.

Usage

Usage(arg2: str) -> None

Writes usage (warning) messages to the OEErrorHandler.

Verbose

Verbose(arg2: str) -> None

Writes messages with the OEErrorLevel_Verbose error message level to the OEErrorHandler. By default, these messages will not appear.

Warning

Warning(arg2: str) -> None

Writes warning messages to the OEErrorHandler.