Exceptions#
Every error the package raises on purpose derives from AttributionAnalysisError. Since 0.4.0 the
errors that replaced a bare ValueError or TypeError also subclass that builtin, so existing
except ValueError code keeps working.
Hierarchical exception system for the attribution analysis engine.
This module provides a structured exception hierarchy following the clean, layered error-handling architecture. Exceptions are designed to be:
Simple: Plain exception classes without unnecessary complexity
Self-descriptive: Exception names clearly indicate the error domain
Chainable: Support for exception chaining via
raise ... from errorGroupable: ExceptionGroup support for aggregating multiple related errors
Compatible: the errors that replaced a bare
ValueErrororTypeErroralso subclass it, soexcept ValueError/except TypeErrorcallers keep working
Exception Hierarchy#
AttributionAnalysisError (base for recoverable errors)
├── ConfigurationError
│ ├── ConfigurationHandlerError
│ ├── InjectedDependencyError
│ └── AttributionArgumentError (also ValueError)
├── DataError
│ ├── DataLoadingError
│ │ ├── MissingCSVReadError
│ │ ├── ReadingCSVError
│ │ ├── ReadingCsvPortfolioError
│ │ ├── ReadingExcelPortfolioError
│ │ ├── MissingPortfolioError
│ │ ├── MissingBenchmarkError
│ │ └── MissingXLSXReadError
│ ├── DataValidationError
│ │ ├── MissingColumnError
│ │ ├── MissingDataError
│ │ ├── DataIntegrityError
│ │ ├── DataAlignmentError
│ │ │ └── SeriesAlignmentError (also ValueError)
│ │ ├── DateRangeError
│ │ └── NullError
│ └── DataTransformationError
│ ├── EntityFieldTypeError
│ ├── TypePreservationError
│ ├── DateParsingError
│ │ └── DateConversionError (also ValueError)
│ ├── DateObtentionError
│ └── DataPipelineError
├── PortfolioError
│ ├── PortfolioEntityError
│ └── PortfolioValidationError
├── PerformanceAttributionError
├── EntityValueError
├── EntityTypeError
├── ReturnsTimeSeriesError
│ └── ReturnsTypeError (also TypeError)
├── TemplateDirectoryError
└── LicenseError (also kaxanuk.license_client.LicenseError)
├── LicenseConfigurationError
├── LicenseNotFoundError
├── LicenseValidationError
└── LicenseServerError
- exception AttributionAnalysisError[source]#
Bases:
ExceptionBase class for all attribution analysis exceptions.
This is the root of the exception hierarchy for errors that can be caught and handled during normal operation.
- exception AttributionArgumentError[source]#
Bases:
ConfigurationError,ValueErrorAn argument of an attribution class or function is invalid or inconsistent.
For example an unknown formula or linking method, missing weights, or return tables passed in a combination the class does not accept. Also a
ValueError, which these arguments raised before 0.4.0.
- exception ConfigurationError[source]#
Bases:
AttributionAnalysisErrorConfiguration validation or parsing errors.
Raised when configuration parameters are invalid, missing, or incompatible.
- exception ConfigurationHandlerError[source]#
Bases:
ConfigurationErrorError in configuration handler processing.
Raised when a configuration handler (e.g., ExcelConfigurator) fails to read or parse the configuration source.
- exception DataAlignmentError[source]#
Bases:
DataValidationErrorData alignment between sources failed.
- exception DataError[source]#
Bases:
AttributionAnalysisErrorBase class for all data-related errors.
Covers errors during data loading, validation, and transformation.
- exception DataIntegrityError[source]#
Bases:
DataValidationErrorData integrity check failed.
- exception DataLoadingError[source]#
Bases:
DataErrorErrors during data loading phase.
Raised when attempting to read data from files or external sources fails.
- exception DataPipelineError[source]#
Bases:
DataTransformationErrorError in data pipeline execution.
- exception DataTransformationError[source]#
Bases:
DataErrorErrors during data transformation phase.
Raised when data cannot be converted, parsed, or transformed to the required format or type.
- exception DataValidationError[source]#
Bases:
DataErrorErrors during data validation phase.
Raised when loaded data fails validation checks.
- exception DateConversionError[source]#
Bases:
DateParsingError,ValueErrorA requested date cannot be converted to the date type of the data.
Also a
ValueError, as before 0.4.0.
- exception DateObtentionError[source]#
Bases:
DataTransformationErrorError obtaining date values from data.
- exception DateParsingError[source]#
Bases:
DataTransformationErrorDate string could not be parsed.
- exception DateRangeError[source]#
Bases:
DataValidationErrorRequested date range is not covered by input data.
- exception EntityFieldTypeError[source]#
Bases:
DataTransformationErrorEntity field has incorrect type.
- exception EntityTypeError[source]#
Bases:
AttributionAnalysisErrorEntity type is invalid.
- exception EntityValueError[source]#
Bases:
AttributionAnalysisErrorEntity value is invalid.
- exception InjectedDependencyError[source]#
Bases:
ConfigurationErrorError with injected dependencies.
Raised when dependencies passed to the main function or factory methods do not satisfy the required interfaces or contracts.
- exception LicenseConfigurationError[source]#
Bases:
LicenseError,LicenseConfigurationErrorThe license check is misconfigured: a malformed license server URL.
Raised when
KNAA_LICENSE_SERVER_URLorKAXANUK_LICENSE_SERVER_URLis not an http or https URL a request can be sent to. Nothing was sent to any server.
- exception LicenseError[source]#
Bases:
AttributionAnalysisError,LicenseErrorBase class for license-related errors.
The license check is kaxanuk-license-client’s, which raises the subclasses below: each one is also the client’s matching error, so both
except AttributionAnalysisErrorandexcept kaxanuk.license_client.LicenseErrorcatch it.
- exception LicenseNotFoundError[source]#
Bases:
LicenseError,LicenseNotFoundErrorNo license key was found in the environment, home, or working directory.
- exception LicenseServerError[source]#
Bases:
LicenseError,LicenseServerErrorThe license server is unreachable and no saved validation can stand in for it.
- exception LicenseValidationError[source]#
Bases:
LicenseError,LicenseValidationErrorThe license server rejected the provided license key.
An unknown key, an expired or revoked license, a license that does not include Attribution Analysis, or no device seat left.
- MissingBenchmark#
alias of
MissingBenchmarkError
- exception MissingBenchmarkError[source]#
Bases:
DataLoadingErrorBenchmark data file not found.
- exception MissingCSVReadError[source]#
Bases:
DataLoadingErrorCSV file could not be read or is missing.
- exception MissingColumnError[source]#
Bases:
DataValidationErrorRequired column is missing from data.
- exception MissingDataError[source]#
Bases:
DataValidationErrorRequired data is missing.
- MissingPortfolio#
alias of
MissingPortfolioError
- exception MissingPortfolioError[source]#
Bases:
DataLoadingErrorPortfolio file not found or cannot be loaded.
- exception MissingXLSXReadError[source]#
Bases:
DataLoadingErrorXLSX file could not be read or is missing.
- exception NullError[source]#
Bases:
DataValidationErrorUnexpected null/None values in data.
- exception PerformanceAttributionError[source]#
Bases:
AttributionAnalysisErrorError in performance attribution calculations.
- exception PortfolioEntityError[source]#
Bases:
PortfolioErrorError in portfolio entity construction or access.
- exception PortfolioError[source]#
Bases:
AttributionAnalysisErrorBase class for portfolio-related errors.
- exception PortfolioValidationError[source]#
Bases:
PortfolioErrorPortfolio validation failed.
- exception ReadingCSVError[source]#
Bases:
DataLoadingErrorError while parsing CSV file content.
- exception ReadingCsvPortfolioError[source]#
Bases:
DataLoadingErrorError reading portfolio from CSV file.
- exception ReadingExcelPortfolioError[source]#
Bases:
DataLoadingErrorError reading portfolio from Excel file.
- exception ReturnsTimeSeriesError[source]#
Bases:
AttributionAnalysisErrorError in returns time series processing.
- exception ReturnsTypeError[source]#
Bases:
ReturnsTimeSeriesError,TypeErrorA returns argument has an unsupported type (a pandas Series or DataFrame is expected).
Also a
TypeError, as before 0.4.0.
- exception SeriesAlignmentError[source]#
Bases:
DataAlignmentError,ValueErrorSeries that must line up have different shapes.
For example portfolio, benchmark and effect series of different lengths passed to multi-period linking. Also a
ValueError, as before 0.4.0.
- exception TemplateDirectoryError[source]#
Bases:
AttributionAnalysisErrorThe templates directory required by the CLI could not be located.
- exception TypePreservationError[source]#
Bases:
DataTransformationErrorType preservation failed during transformation.