@contentstack/cli-utilities
Version:
Utilities for contentstack projects
24 lines (23 loc) • 1.11 kB
TypeScript
import { default as Logger } from './logger';
import { CLIErrorHandler } from './cliErrorHandler';
import { ErrorContext } from '../interfaces';
declare const v2Logger: Logger;
declare const cliErrorHandler: CLIErrorHandler;
/**
* Handles and logs an error by classifying it and logging the relevant details.
*
* This function uses the `cliErrorHandler` to classify the provided error and logs
* the error details using `v2Logger`. If debug information is available, it logs
* additional debug details, including a stack trace if not already present.
*
* @param error - The error to be handled and logged. Can be of any type.
* @param context - Optional context information to assist in error classification
* and logging.
*
* @remarks
* - The error is always logged with its type, message, and other metadata.
* - If debug information is available, it is logged separately with a more specific
* debug type and additional details.
*/
declare function handleAndLogError(error: unknown, context?: ErrorContext): void;
export { v2Logger, cliErrorHandler, handleAndLogError };