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 | 1x 1x 42x 42x 42x 1x 1x 1x 3x 3x 3x 1x 1x 1x 3x 3x 3x 1x 1x 1x 4x 4x 4x 1x 1x 1x 3x 3x 3x 1x 1x 25x 25x 25x 25x 25x 25x 25x 25x 1x 1x 2x 2x 2x 1x 1x 1x 3x 3x 3x 1x 1x | /**
* Typed error hierarchy for agentix-timesfm-ts.
*
* All project errors extend `TimesFMError` so callers can catch them
* with a single `instanceof` check. Each subclass carries structured
* context (HTTP status, field name, etc.) 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';
}
}
|