credmark.cmf.model.errors.ModelBaseError

exception ModelBaseError(message, **data)[source]

Base error class for Credmark model errors. You should not create instances of this class directly.

The main error types are:
  • ModelDataError: An error that occurs during the lookup, generation, or processing of data. It is not an error in the code but an but an unexpected situation with the data. For example, a request for a contract at an address that does not exist will return a ModelDataError. This error is considered deterministic and permanent, in the sense that for the given context, the same error will always occur.

  • ModelInputError: An error that occurs when the input data for a model is being validated. Usually it is caused by missing fields, fields of the wrong type, or conflicting data. In the returned error the last stack entry is the model whose input triggered the error.

  • ModelRunError: An error that occurs during the running of a model. This error is usually related to a model coding error or not properly handling exceptions from web3, math libraries etc. These errors are considered transient because it is expected they could give a different result if run again, for example if the code was fixed or a web3 connection issue was resolved etc.

  • ModelEngineError: An error occurred in the model running engine. These errors are considered transient because they usually relate to network or resource issues.

Subclasses can create a custom DTO class and set the dto_class property. They should override the __init__ method with extra params (as needed) and **kwargs (for safety) and call super() with the extra args defined in the dto. See ModelDataError for an example.

Subclasses must be able to be initialized from a normally and with their full dto json as a **kwargs. If you set a custom message or other default values in your __init__, be sure not to have duplicate keys.

The dto data object is accessible at error.data

Parameters

message (str) –