Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | 1x 1x 59x 59x 59x 1x 1x 1x 4x 4x 4x 1x 1x 1x 3x 3x 3x 1x 1x 1x 5x 5x 5x 1x 1x 1x 3x 3x 3x 1x 1x 26x 26x 26x 26x 26x 26x 26x 26x 1x 1x 2x 2x 2x 1x 1x 1x 3x 3x 3x 1x 1x 2x 2x 2x 2x 2x 2x 2x 2x 1x 1x 8x 8x 8x 1x 1x 1x 4x 4x 4x 1x | /**
* Typed error hierarchy for timesfm-ts.
*
* All project errors extend `TimesFMError` so callers can catch them
* with a single `instanceof` check. Select subclasses (DownloadError,
* InferenceError) carry structured context for programmatic handling.
*
* Backward-compatible: every error class extends the built-in `Error`,
* so existing `instanceof Error` / `rejects.toThrow()` assertions are
* unaffected.
*/
// ---------------------------------------------------------------------------
// Root
// ---------------------------------------------------------------------------
/** Base class for all TimesFM errors. */
export class TimesFMError extends Error {
constructor(message?: string) {
super(message);
this.name = 'TimesFMError';
}
}
// ---------------------------------------------------------------------------
// Model lifecycle
// ---------------------------------------------------------------------------
/** The model has not been compiled yet. */
export class ModelNotCompiledError extends TimesFMError {
constructor(message?: string) {
super(message);
this.name = 'ModelNotCompiledError';
}
}
/** The model path is required but was not provided. */
export class ModelNotFoundError extends TimesFMError {
constructor(message?: string) {
super(message);
this.name = 'ModelNotFoundError';
}
}
// ---------------------------------------------------------------------------
// Configuration
// ---------------------------------------------------------------------------
/** Forecast configuration validation failed. */
export class ConfigValidationError extends TimesFMError {
constructor(message?: string) {
super(message);
this.name = 'ConfigValidationError';
}
}
/** The requested horizon exceeds the compiled maxHorizon. */
export class HorizonExceededError extends TimesFMError {
constructor(message?: string) {
super(message);
this.name = 'HorizonExceededError';
}
}
// ---------------------------------------------------------------------------
// Model download
// ---------------------------------------------------------------------------
/** Generic download failure (HTTP error, network, etc.). */
export class DownloadError extends TimesFMError {
constructor(
message: string,
public readonly httpStatus: number,
) {
super(message);
this.name = 'DownloadError';
}
}
/** Proxy authentication failed (HTTP 407). */
export class ProxyAuthError extends DownloadError {
constructor(message: string, httpStatus: number) {
super(message, httpStatus);
this.name = 'ProxyAuthError';
}
}
/** Downloaded file checksum does not match the expected value. */
export class ChecksumMismatchError extends TimesFMError {
constructor(message?: string) {
super(message);
this.name = 'ChecksumMismatchError';
}
}
// ---------------------------------------------------------------------------
// Inference
// ---------------------------------------------------------------------------
/** ONNX Runtime inference failure. */
export class InferenceError extends TimesFMError {
constructor(
message: string,
public readonly cause?: Error,
) {
super(message);
this.name = 'InferenceError';
}
}
// ---------------------------------------------------------------------------
// Hierarchical reconciliation
// ---------------------------------------------------------------------------
/** Hierarchy definition validation failure (orphan nodes, cycles, etc.). */
export class HierarchyValidationError extends TimesFMError {
constructor(message?: string) {
super(message);
this.name = 'HierarchyValidationError';
}
}
/** Covariate / regression engine error. */
export class CovariateError extends TimesFMError {
constructor(message?: string) {
super(message);
this.name = 'CovariateError';
}
}
|