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 error

  • Groupable: ExceptionGroup support for aggregating multiple related errors

  • Compatible: the errors that replaced a bare ValueError or TypeError also subclass it, so except ValueError / except TypeError callers 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: Exception

Base 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, ValueError

An 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: AttributionAnalysisError

Configuration validation or parsing errors.

Raised when configuration parameters are invalid, missing, or incompatible.

exception ConfigurationHandlerError[source]#

Bases: ConfigurationError

Error in configuration handler processing.

Raised when a configuration handler (e.g., ExcelConfigurator) fails to read or parse the configuration source.

exception DataAlignmentError[source]#

Bases: DataValidationError

Data alignment between sources failed.

exception DataError[source]#

Bases: AttributionAnalysisError

Base class for all data-related errors.

Covers errors during data loading, validation, and transformation.

exception DataIntegrityError[source]#

Bases: DataValidationError

Data integrity check failed.

exception DataLoadingError[source]#

Bases: DataError

Errors during data loading phase.

Raised when attempting to read data from files or external sources fails.

exception DataPipelineError[source]#

Bases: DataTransformationError

Error in data pipeline execution.

exception DataTransformationError[source]#

Bases: DataError

Errors during data transformation phase.

Raised when data cannot be converted, parsed, or transformed to the required format or type.

exception DataValidationError[source]#

Bases: DataError

Errors during data validation phase.

Raised when loaded data fails validation checks.

exception DateConversionError[source]#

Bases: DateParsingError, ValueError

A requested date cannot be converted to the date type of the data.

Also a ValueError, as before 0.4.0.

exception DateObtentionError[source]#

Bases: DataTransformationError

Error obtaining date values from data.

exception DateParsingError[source]#

Bases: DataTransformationError

Date string could not be parsed.

exception DateRangeError[source]#

Bases: DataValidationError

Requested date range is not covered by input data.

exception EntityFieldTypeError[source]#

Bases: DataTransformationError

Entity field has incorrect type.

exception EntityTypeError[source]#

Bases: AttributionAnalysisError

Entity type is invalid.

exception EntityValueError[source]#

Bases: AttributionAnalysisError

Entity value is invalid.

exception InjectedDependencyError[source]#

Bases: ConfigurationError

Error 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, LicenseConfigurationError

The license check is misconfigured: a malformed license server URL.

Raised when KNAA_LICENSE_SERVER_URL or KAXANUK_LICENSE_SERVER_URL is not an http or https URL a request can be sent to. Nothing was sent to any server.

exception LicenseError[source]#

Bases: AttributionAnalysisError, LicenseError

Base 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 AttributionAnalysisError and except kaxanuk.license_client.LicenseError catch it.

exception LicenseNotFoundError[source]#

Bases: LicenseError, LicenseNotFoundError

No license key was found in the environment, home, or working directory.

exception LicenseServerError[source]#

Bases: LicenseError, LicenseServerError

The license server is unreachable and no saved validation can stand in for it.

exception LicenseValidationError[source]#

Bases: LicenseError, LicenseValidationError

The 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: DataLoadingError

Benchmark data file not found.

exception MissingCSVReadError[source]#

Bases: DataLoadingError

CSV file could not be read or is missing.

exception MissingColumnError[source]#

Bases: DataValidationError

Required column is missing from data.

exception MissingDataError[source]#

Bases: DataValidationError

Required data is missing.

MissingPortfolio#

alias of MissingPortfolioError

exception MissingPortfolioError[source]#

Bases: DataLoadingError

Portfolio file not found or cannot be loaded.

exception MissingXLSXReadError[source]#

Bases: DataLoadingError

XLSX file could not be read or is missing.

exception NullError[source]#

Bases: DataValidationError

Unexpected null/None values in data.

exception PerformanceAttributionError[source]#

Bases: AttributionAnalysisError

Error in performance attribution calculations.

exception PortfolioEntityError[source]#

Bases: PortfolioError

Error in portfolio entity construction or access.

exception PortfolioError[source]#

Bases: AttributionAnalysisError

Base class for portfolio-related errors.

exception PortfolioValidationError[source]#

Bases: PortfolioError

Portfolio validation failed.

exception ReadingCSVError[source]#

Bases: DataLoadingError

Error while parsing CSV file content.

exception ReadingCsvPortfolioError[source]#

Bases: DataLoadingError

Error reading portfolio from CSV file.

exception ReadingExcelPortfolioError[source]#

Bases: DataLoadingError

Error reading portfolio from Excel file.

exception ReturnsTimeSeriesError[source]#

Bases: AttributionAnalysisError

Error in returns time series processing.

exception ReturnsTypeError[source]#

Bases: ReturnsTimeSeriesError, TypeError

A 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, ValueError

Series 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: AttributionAnalysisError

The templates directory required by the CLI could not be located.

exception TypePreservationError[source]#

Bases: DataTransformationError

Type preservation failed during transformation.