simplebench.exceptions package🔗
Custom exceptions for the simplebench package.
- class simplebench.exceptions.ErrorTag(value)[source]🔗
-
Base class for error tag enums.
ErrorTags are used to identify specific error condition sources in the simplebench package.
Tests use these tags to assert specific error condition paths.
- exception simplebench.exceptions.SimpleBenchArgumentError( )[source]🔗
Bases:
TaggedException[ArgumentError]Base class for re-raising all SimpleBench ArgumentError errors.
It is designed to be used in places where an argparse.ArgumentError would be appropriate and for re-raising ArgumentErrors caught from argparse operations.
It differs from a argparse.ArgumentError by the addition of a tag code used to very specifically identify where the error was thrown in the code for testing and development support and by directly setting the argument_name property to the name of the argument that caused the error. This is because the argparse.ArgumentError constructor expects an argparse.Action instance as the first argument and that is not always available when re-raising the exception.
This tag code does not have a direct semantic meaning except to identify the specific code throwing the exception for tests.
- Usage:
- raise SimpleBenchArgumentError(argument_name=”my-arg”,
message=”An error occurred”, tag=MyErrorTags.SOME_ERROR)
- Parameters:
Initializes the exception with a mandatory tag.
- Parameters:
*args – Positional arguments to pass to the base exception’s constructor.
tag (Enum, keyword) – An Enum member representing the error code.
**kwargs – Keyword arguments to pass to the base exception’s constructor.
- exception simplebench.exceptions.SimpleBenchAttributeError( )[source]🔗
Bases:
TaggedException[AttributeError]Base class for all SimpleBench attribute errors.
It differs from a standard AttributeError by the addition of a tag code used to very specifically identify where the error was thrown in the code for testing and development support.
This tag code does not have a direct semantic meaning except to identify the specific code throwing the exception for tests.
- Usage:
raise SimpleBenchAttributeError(“An error occurred”, tag=MyErrorTags.SOME_ERROR)
- Parameters:
Raises a SimpleBenchAttributeError with the given message, name, obj, and tag.
- exception simplebench.exceptions.SimpleBenchBenchmarkError( )[source]🔗
Bases:
TaggedException[RuntimeError]Exceptions raised for benchmark execution errors.
If an exception occurs during the execution of a benchmark, it can be wrapped in a SimpleBenchBenchmarkError to provide additional context and tagging.
- Usage:
- raise SimpleBenchBenchmarkError(“An error occurred”,
tag=MyErrorTags.SOME_ERROR)
Raises a SimpleBenchBenchmarkError with the given message and tag.
- exception simplebench.exceptions.SimpleBenchImportError( )[source]🔗
Bases:
TaggedException[ImportError]Base class for all SimpleBench import errors.
It differs from a standard ImportError by the addition of a tag code used to very specifically identify where the error was thrown in the code for testing and development support.
This tag code does not have a direct semantic meaning except to identify the specific code throwing the exception for tests.
- Usage:
raise SimpleBenchImportError(“An error occurred”, tag=MyErrorTags.SOME_ERROR)
Raises a SimpleBenchImportError with the given message and tag.
- exception simplebench.exceptions.SimpleBenchKeyError( )[source]🔗
Bases:
TaggedException[KeyError]Base class for all SimpleBench key errors.
It differs from a standard KeyError by the addition of a tag code used to very specifically identify where the error was thrown in the code for testing and development support.
This tag code does not have a direct semantic meaning except to identify the specific code throwing the exception for tests.
- Usage:
raise SimpleBenchKeyError(“An error occurred”, tag=MyErrorTags.SOME_ERROR)
Raises a SimpleBenchKeyError with the given message and tag.
- exception simplebench.exceptions.SimpleBenchNotImplementedError( )[source]🔗
Bases:
TaggedException[NotImplementedError]Base class for all SimpleBench not implemented errors.
It differs from a standard NotImplementedError by the addition of a tag code used to very specifically identify where the error was thrown in the code for testing and development support.
This tag code does not have a direct semantic meaning except to identify the specific code throwing the exception for tests.
- Usage:
raise SimpleBenchNotImplementedError(“An error occurred”, tag=MyErrorTags.SOME_ERROR)
Raises a SimpleBenchNotImplementedError with the given message and tag.
- exception simplebench.exceptions.SimpleBenchRuntimeError( )[source]🔗
Bases:
TaggedException[RuntimeError]Base class for all SimpleBench runtime errors.
It differs from a standard RuntimeError by the addition of a tag code used to very specifically identify where the error was thrown in the code for testing and development support.
This tag code does not have a direct semantic meaning except to identify the specific code throwing the exception for tests.
- Usage:
raise SimpleBenchRuntimeError(“An error occurred”, tag=MyErrorTags.SOME_ERROR)
Raises a SimpleBenchRuntimeError with the given message and tag.
- exception simplebench.exceptions.SimpleBenchTypeError( )[source]🔗
Bases:
TaggedException[ValueError]Base class for all SimpleBench type errors.
It differs from a standard TypeError by the addition of a tag code used to very specifically identify where the error was thrown in the code for testing and development support.
This tag code does not have a direct semantic meaning except to identify the specific code throwing the exception for tests.
- Usage:
raise SimpleBenchTypeError(“An error occurred”, tag=MyErrorTags.SOME_ERROR)
Raises a SimpleBenchTypeError with the given message and tag.
- exception simplebench.exceptions.SimpleBenchValueError( )[source]🔗
Bases:
TaggedException[ValueError]Base class for all SimpleBench value errors.
It differs from a standard ValueError by the addition of a tag code used to very specifically identify where the error was thrown in the code for testing and development support.
This tag code does not have a direct semantic meaning except to identify the specific code throwing the exception for tests.
- Usage:
raise SimpleBenchValueError(“An error occurred”, tag=MyErrorTags.SOME_ERROR)
Raises a SimpleBenchValueError with the given message and tag.
- exception simplebench.exceptions.TaggedException( )[source]🔗
-
A generic exception that can be specialized with a base exception type and requires a tag during instantiation.
This class extends the built-in Exception class and adds a mandatory tag attribute. The tag is intended to provide additional context or categorization for the exception.
The tag must be an instance of Enum to ensure a controlled set of possible tags and must be the first argument provided during instantiation if passed positionally.
It is used by other exceptions in the simplebench package to provide standardized error tagging for easier identification and handling of specific error conditions. and is used to create exceptions with specific tags for error handling and identification. with this base class.
Example:
class MyTaggedException(TaggedException[ValueError]): ‘’’A tagged exception that is a specialized ValueError.’’’
raise MyTaggedException(“An error occurred”, tag=MyErrorTags.SOME_ERROR)
- Parameters:
tag (Enum, keyword) – An Enum member representing the error code.
*args – Positional arguments to pass to the base exception’s constructor.
**kwargs – Keyword arguments to pass to the base exception’s constructor.
- tag_code🔗
Enum
Initializes the exception with a mandatory tag.
- Parameters:
*args – Positional arguments to pass to the base exception’s constructor.
tag (Enum, keyword) – An Enum member representing the error code.
**kwargs – Keyword arguments to pass to the base exception’s constructor.
Submodules🔗
- simplebench.exceptions.base module
- simplebench.exceptions.case module
- simplebench.exceptions.choices module
- simplebench.exceptions.cli module
- simplebench.exceptions.decorators module
- simplebench.exceptions.iteration module
- simplebench.exceptions.results module
- simplebench.exceptions.runners module
- simplebench.exceptions.session module
- simplebench.exceptions.si_units module
- simplebench.exceptions.tasks module