validmind.errors

This module contains all the custom errors that are used in the library.

The following base errors are defined for others:

  • BaseError
  • APIRequestError
class BaseError(builtins.Exception):

Common base class for all non-exit exceptions.

BaseError(message='')
def description(self, *args, **kwargs):
Inherited Members
builtins.BaseException
with_traceback
add_note
class APIRequestError(BaseError):

Generic error for API request errors that are not known.

Inherited Members
BaseError
BaseError
description
builtins.BaseException
with_traceback
add_note
class GetTestSuiteError(BaseError):

When the test suite could not be found.

Inherited Members
BaseError
BaseError
description
builtins.BaseException
with_traceback
add_note
class MissingCacheResultsArgumentsError(BaseError):

When the cache_results function is missing arguments.

Inherited Members
BaseError
BaseError
description
builtins.BaseException
with_traceback
add_note
class MissingOrInvalidModelPredictFnError(BaseError):

When the pytorch model is missing a predict function or its predict method does not have the expected arguments.

Inherited Members
BaseError
BaseError
description
builtins.BaseException
with_traceback
add_note
class InitializeTestSuiteError(BaseError):

When the test suite was found but could not be initialized.

Inherited Members
BaseError
BaseError
description
builtins.BaseException
with_traceback
add_note
class InvalidAPICredentialsError(APIRequestError):

Generic error for API request errors that are not known.

def description(self, *args, **kwargs):
Inherited Members
BaseError
BaseError
builtins.BaseException
with_traceback
add_note
class InvalidContentIdPrefixError(APIRequestError):

When an invalid text content_id is sent to the API.

Inherited Members
BaseError
BaseError
description
builtins.BaseException
with_traceback
add_note
class InvalidFigureForObjectError(BaseError):

When a figure was constructed with an unsupported for_object value.

Inherited Members
BaseError
BaseError
description
builtins.BaseException
with_traceback
add_note
class InvalidMetricResultsError(APIRequestError):

When an invalid metric results object is sent to the API.

Inherited Members
BaseError
BaseError
description
builtins.BaseException
with_traceback
add_note
class InvalidProjectError(APIRequestError):

Generic error for API request errors that are not known.

def description(self, *args, **kwargs):
Inherited Members
BaseError
BaseError
builtins.BaseException
with_traceback
add_note
class InvalidRequestBodyError(APIRequestError):

When a POST/PUT request is made with an invalid request body.

Inherited Members
BaseError
BaseError
description
builtins.BaseException
with_traceback
add_note
class InvalidTestResultsError(APIRequestError):

When an invalid test results object is sent to the API.

Inherited Members
BaseError
BaseError
description
builtins.BaseException
with_traceback
add_note
class InvalidTestParametersError(BaseError):

When an invalid parameters for the test.

Inherited Members
BaseError
BaseError
description
builtins.BaseException
with_traceback
add_note
class InvalidInputError(BaseError):

When an invalid input object.

Inherited Members
BaseError
BaseError
description
builtins.BaseException
with_traceback
add_note
class InvalidTextObjectError(APIRequestError):

When an invalid Metadat (Text) object is sent to the API.

Inherited Members
BaseError
BaseError
description
builtins.BaseException
with_traceback
add_note
class InvalidValueFormatterError(BaseError):

When an invalid value formatter is provided when serializing results.

Inherited Members
BaseError
BaseError
description
builtins.BaseException
with_traceback
add_note
class InvalidXGBoostTrainedModelError(BaseError):

When an invalid XGBoost trained model is used when calling init_r_model.

Inherited Members
BaseError
BaseError
description
builtins.BaseException
with_traceback
add_note
class LoadTestError(BaseError):

Exception raised when an error occurs while loading a test

Inherited Members
BaseError
BaseError
description
builtins.BaseException
with_traceback
add_note
class MismatchingClassLabelsError(BaseError):

When the class labels found in the dataset don't match the provided target labels.

Inherited Members
BaseError
BaseError
description
builtins.BaseException
with_traceback
add_note
class MissingAPICredentialsError(BaseError):

Common base class for all non-exit exceptions.

def description(self, *args, **kwargs):
Inherited Members
BaseError
BaseError
builtins.BaseException
with_traceback
add_note
class MissingClassLabelError(BaseError):

When the one or more class labels are missing from provided dataset targets.

Inherited Members
BaseError
BaseError
description
builtins.BaseException
with_traceback
add_note
class MissingDocumentationTemplate(BaseError):

When the client config is missing the documentation template.

Inherited Members
BaseError
BaseError
description
builtins.BaseException
with_traceback
add_note
class MissingRequiredTestInputError(BaseError):

When a required test context variable is missing.

Inherited Members
BaseError
BaseError
description
builtins.BaseException
with_traceback
add_note
class MissingDependencyError(BaseError):

When a required dependency is missing.

MissingDependencyError(message='', required_dependencies=None, extra=None)
Arguments:
  • message (str): The error message.
  • required_dependencies (list): A list of required dependencies.
  • extra (str): The particular validmind extra that will install the missing dependencies.
Inherited Members
BaseError
description
builtins.BaseException
with_traceback
add_note
class MissingRExtrasError(BaseError):

When the R extras have not been installed.

def description(self, *args, **kwargs):
Inherited Members
BaseError
BaseError
builtins.BaseException
with_traceback
add_note
class MissingTextContentIdError(APIRequestError):

When a Text object is sent to the API without a content_id.

Inherited Members
BaseError
BaseError
description
builtins.BaseException
with_traceback
add_note
class MissingTextContentsError(APIRequestError):

When a Text object is sent to the API without a "text" attribute.

Inherited Members
BaseError
BaseError
description
builtins.BaseException
with_traceback
add_note
class MissingModelIdError(BaseError):

Common base class for all non-exit exceptions.

def description(self, *args, **kwargs):
Inherited Members
BaseError
BaseError
builtins.BaseException
with_traceback
add_note
class TestInputInvalidDatasetError(BaseError):

When an invalid dataset is used in a test context.

Inherited Members
BaseError
BaseError
description
builtins.BaseException
with_traceback
add_note
class UnsupportedColumnTypeError(BaseError):

When an unsupported column type is found on a dataset.

Inherited Members
BaseError
BaseError
description
builtins.BaseException
with_traceback
add_note
class UnsupportedDatasetError(BaseError):

When an unsupported dataset is used.

Inherited Members
BaseError
BaseError
description
builtins.BaseException
with_traceback
add_note
class UnsupportedFigureError(BaseError):

When an unsupported figure object is constructed.

Inherited Members
BaseError
BaseError
description
builtins.BaseException
with_traceback
add_note
class UnsupportedRModelError(BaseError):

When an unsupported R model is used.

Inherited Members
BaseError
BaseError
description
builtins.BaseException
with_traceback
add_note
class UnsupportedModelError(BaseError):

When an unsupported model is used.

Inherited Members
BaseError
BaseError
description
builtins.BaseException
with_traceback
add_note
class UnsupportedModelForSHAPError(BaseError):

When an unsupported model is used for SHAP importance.

Inherited Members
BaseError
BaseError
description
builtins.BaseException
with_traceback
add_note
class SkipTestError(BaseError):

Useful error to throw when a test cannot be executed.

Inherited Members
BaseError
BaseError
description
builtins.BaseException
with_traceback
add_note
def raise_api_error(error_string):

Safely try to parse JSON from the response message in case the API returns a non-JSON string or if the API returns a non-standard error

def should_raise_on_fail_fast(error) -> bool:

Determine whether an error should be raised when fail_fast is True.