import { AnyJson } from '@salesforce/ts-types';
export type SfErrorOptions<T extends ErrorDataProperties = ErrorDataProperties> = {
    message: string;
    exitCode?: number;
    name?: string;
    data?: T;
    /** pass an Error.  For convenience in catch blocks, code will check that it is, in fact, an Error */
    cause?: unknown;
    context?: string;
    actions?: string[];
};
type ErrorDataProperties = AnyJson;
type SfErrorToObjectResult = {
    name: string;
    message: string;
    exitCode: number;
    actions?: string[];
    context?: string;
    data?: ErrorDataProperties;
};
/**
 * A generalized sfdx error which also contains an action. The action is used in the
 * CLI to help guide users past the error.
 *
 * To throw an error in a synchronous function you must either pass the error message and actions
 * directly to the constructor, e.g.
 *
 * ```
 * // To load a message bundle (Note that __dirname should contain a messages folder)
 * Messages.importMessagesDirectory(__dirname);
 * const messages = Messages.load('myPackageName', 'myBundleName');
 *
 * // To throw a non-bundle based error:
 * throw new SfError(message.getMessage('myError'), 'MyErrorName');
 * ```
 */
export declare class SfError<T extends ErrorDataProperties = ErrorDataProperties> extends Error {
    #private;
    readonly name: string;
    /**
     * Action messages. Hints to the users regarding what can be done to fix related issues.
     */
    actions?: string[];
    /**
     * SfdxCommand can return this process exit code.
     */
    exitCode: number;
    /**
     * The related context for this error.
     */
    context?: string;
    data?: T;
    /**
     * Create an SfError.
     *
     * @param message The error message.
     * @param name The error name. Defaults to 'SfError'.
     * @param actions The action message(s).
     * @param exitCodeOrCause The exit code which will be used by SfdxCommand or he underlying error that caused this error to be raised.
     * @param cause The underlying error that caused this error to be raised.
     */
    constructor(message: string, name?: string, actions?: string[], exitCodeOrCause?: number | Error, cause?: unknown);
    get code(): string;
    set code(code: string);
    /** like the constructor, but takes an typed object and let you also set context and data properties */
    static create<T extends ErrorDataProperties = ErrorDataProperties>(inputs: SfErrorOptions<T>): SfError<T>;
    /**
     * Convert an Error to an SfError.
     *
     * @param err The error to convert.
     */
    static wrap<T extends ErrorDataProperties = ErrorDataProperties>(err: unknown): SfError<T>;
    /**
     * Sets the context of the error. For convenience `this` object is returned.
     *
     * @param context The command name.
     */
    setContext(context: string): SfError;
    /**
     * An additional payload for the error. For convenience `this` object is returned.
     *
     * @param data The payload data.
     */
    setData(data: T): SfError;
    /**
     * Convert an {@link SfError} state to an object. Returns a plain object representing the state of this error.
     */
    toObject(): SfErrorToObjectResult;
}
export {};
