gensaschema._exceptions module

Copyright:

Copyright 2014 - 2023 André Malo or his licensors, as applicable

License:

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

GenSASchema Exceptions

The module provides all exceptions and warnings used throughout the gensaschema package.

exception gensaschema._exceptions.Error[source]

Base exception for this package

__annotations__ = {}
__module__ = 'gensaschema._exceptions'
__weakref__

list of weak references to the object (if defined)

exception gensaschema._exceptions.Warning[source]

Base warning for this package

>>> with _warnings.catch_warnings(record=True) as record:
...     Warning.emit('my message')
...     assert len(record) == 1
...     str(record[0].message)
'my message'
>>> _warnings.simplefilter('error')
>>> Warning.emit('lalala')
Traceback (most recent call last):
...
Warning: lalala
__annotations__ = {}
__module__ = 'gensaschema._exceptions'
__weakref__

list of weak references to the object (if defined)

classmethod emit(message, stacklevel=1)[source]

Emit a warning of this very category

This method is pure convenience. It saves you the unfriendly warnings.warn syntax (and the warnings import).

Parameters:
messageany

The warning message

stacklevelint

Number of stackframes to go up in order to place the warning source. This is useful for generic warning-emitting helper functions. The stacklevel of this helper function is already taken into account.