/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import type { MaybePromise } from "#util/Promises.js";
/**
 * Error base class for all errors thrown by this library.
 */
export declare class MatterError extends Error {
    /**
     * Convert the error to formatted text.
     *
     * matter.js encodes errors with modern JS features including {@link Error#cause} and {@link AggregateError#errors}
     * subfields.  You can use this function to ensure all error details are presented regardless of environment.
     */
    format(format?: "plain" | "ansi" | "html", indents?: number): string;
    /**
     * A unique textual identifier for the error.
     */
    get id(): string;
    /**
     * A unique textual identifier for the error.
     */
    static get id(): string;
    /**
     * Obtain matter.js-style error ID for given error constructor.
     */
    static idFor(type: {
        name: string;
    }): string;
    /**
     * Rethrow an error unless it is an instance of this class.
     */
    static accept<T extends MatterError>(this: new (...args: any[]) => T, error: unknown): asserts error is T;
    /**
     * Rethrow an error if it is an instance of this class.
     */
    static reject(error: unknown): void;
    /**
     * Replace the message in an error.
     *
     * In addition to setting the message, updates the message in the stack.
     */
    static replaceMessage(error: Error, message: string): void;
    /**
     * The fallback formatter factory.  This produces a limited plaintext formatter.
     */
    static defaultFormatterFactory: () => typeof fallbackFormatter;
    /**
     * The error formatter factory.  The default formatter is replaced by Matter.js in ./Format.ts.
     */
    static formatterFor: (formatName: string) => (value: unknown, indents?: number) => unknown;
    /**
     * If the causal chain of an error includes an error of type {@link T}, returns the first such error encountered.
     */
    static of<T extends MatterError>(this: {
        new (...args: any[]): T;
        of: typeof MatterError.of;
    }, error: unknown): T | undefined;
}
/**
 * Error thrown when a Platform specific implementation was not added and so a provider (Network, Time, Crypto, etc)
 * is not available.
 */
export declare class NoProviderError extends MatterError {
}
/**
 * Error thrown when an internal error occurs like unexpected cases or missing data that should be there. Please
 * report such errors.
 */
export declare class InternalError extends MatterError {
}
/** Error thrown when a feature is not implemented yet. Please report such errors. */
export declare class NotImplementedError extends InternalError {
}
/** Error thrown when an unexpected case in the matter flow is encountered. Please report such errors. */
export declare class MatterFlowError extends MatterError {
}
/** Error thrown when an unexpected data is encountered. Please report such errors. */
export declare class UnexpectedDataError extends MatterError {
}
/**
 * Error thrown if most likely an implementation error is detected. Please check and correct your implementation and
 * provided data. if you are sure your code is correct please report the issue.
 */
export declare class ImplementationError extends MatterError {
}
/**
 * Thrown when a dynamic component cannot be loaded.
 */
export declare class ImportError extends MatterError {
}
/**
 * Thrown for write attempts against immutable data.
 */
export declare class ReadOnlyError extends ImplementationError {
    constructor(message?: string);
}
/**
 * Thrown for errors that have multiple underlying causes.
 */
export declare class MatterAggregateError extends AggregateError {
    constructor(causes: Iterable<unknown>, message?: string);
    /**
     * A unique textual identifier for the error.
     */
    get id(): string;
    /**
     * A unique textual identifier for the error.
     */
    static get id(): string;
    /**
     * Add causes without stack traces.
     *
     * This is useful to create a compact representation if all child errors originate externally or from the same
     * logical location as the parent error.
     */
    addStackless(error: Error): void;
    /**
     * Wait for all promises to settle and throw an error if any of them reject as MatterAggregateError
     * (or extended class). Promise results are not returned.
     */
    static allSettled<T = unknown>(promises: Iterable<MaybePromise<T>>, message?: string): Promise<T[]>;
    format: (format?: "plain" | "ansi" | "html", indents?: number) => string;
}
/**
 * It's never reasonable to fail to present error information so we include this rudimentary fallback error formatter.
 */
declare function fallbackFormatter(value: unknown, indents?: number): string;
/**
 * Indicate an asynchronous operation was canceled.
 */
export declare class CanceledError extends MatterError {
    constructor(message?: string, options?: ErrorOptions);
}
/**
 * Indicates an asynchronous operation was canceled due to timeout.
 */
export declare class TimeoutError extends MatterError {
    constructor(message?: string, options?: ErrorOptions);
}
/**
 * Thrown as the primary cause when an {@link AbortController} aborts.
 */
export declare class AbortedError extends CanceledError {
    constructor(message?: string, options?: ErrorOptions);
    /**
     * Determine whether a cause signifies abort.
     *
     * We include {@link DOMException} with name "AbortError" which is the standard error thrown if you invoke
     * {@link AbortController#abort} without a cause.
     */
    static is(cause: unknown): boolean;
    /**
     * Accept both {@link AbortedError} and {@link DOMException} with name "AbortError".
     */
    static accept(cause: unknown): void;
}
/**
 * Thrown when an operation can't complete because a resource is closed.
 */
export declare class ClosedError extends CanceledError {
    constructor(message?: string, options?: ErrorOptions);
}
export {};
//# sourceMappingURL=MatterError.d.ts.map