All files / src/utils error-toolset.ts

100% Statements 6/6
100% Branches 0/0
100% Functions 3/3
100% Lines 6/6

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                        161x 161x                 109x 109x                 51x 51x      
import { StackOneError } from './error-stackone';
 
/**
 * Base exception for toolset errors.
 *
 * A subclass of {@link StackOneError}, so `catch (e) { if (e instanceof StackOneError) … }` is a
 * real catch-all for everything the SDK throws. The two used to be unrelated siblings, which
 * meant the obvious catch-all silently missed the configuration and load errors — the ones a
 * user is most likely to hit on their very first call.
 */
export class ToolSetError extends StackOneError {
	constructor(message: string, options?: ErrorOptions) {
		super(message, options);
		this.name = 'ToolSetError';
	}
}
 
/**
 * Raised when the toolset is configured, or called, with something it cannot use.
 */
export class ToolSetConfigError extends ToolSetError {
	constructor(message: string, options?: ErrorOptions) {
		super(message, options);
		this.name = 'ToolSetConfigError';
	}
}
 
/**
 * Raised when the tool catalog, or the accounts behind it, cannot be loaded.
 */
export class ToolSetLoadError extends ToolSetError {
	constructor(message: string, options?: ErrorOptions) {
		super(message, options);
		this.name = 'ToolSetLoadError';
	}
}