delegate-framework
Version:
A TypeScript framework for building robust, production-ready blockchain workflows with comprehensive error handling, logging, and testing. Maintained by delegate.fun
31 lines • 1.15 kB
TypeScript
/**
* Utility functions for error handling
*/
/**
* Throws an error with proper type checking and handling
* @param error - The error to throw (can be Error, string, or object with message)
* @param context - Optional context information for debugging
*/
export declare function throwError(error: unknown, context?: string): never;
/**
* Safely extracts error message from various error types
* @param error - The error to extract message from
* @returns The error message as a string
*/
export declare function getErrorMessage(error: unknown): string;
/**
* Checks if a value is an error-like object
* @param value - The value to check
* @returns True if the value is an error-like object
*/
export declare function isErrorLike(value: unknown): value is {
message: string;
};
/**
* Creates a standardized error from various input types
* @param error - The error input
* @param defaultMessage - Default message if error is empty/null/undefined
* @returns A standardized Error object
*/
export declare function createStandardError(error: unknown, defaultMessage?: string): Error;
//# sourceMappingURL=error-handling.d.ts.map