All files / utilities error.ts

100% Statements 2/2
50% Branches 1/2
100% Functions 2/2
100% Lines 2/2

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          12x                   18x  
/**
 * Represents an error when a feature or function is not supported by design.
 */
export class NotSupportedError extends Error {
	constructor() {
		super('This feature is not supported.');
	}
}
 
/**
 * Returns a human-readable message for a caught value: the `message` of an
 * `Error`, the string form of anything else. Use this instead of the inline
 * `e instanceof Error ? e.message : String(e)` idiom.
 */
export function getErrorMessage(error: unknown): string {
	return error instanceof Error ? error.message : String(error);
}