import type { Connection } from ".";
/**
 * Base error class for Spectral-specific errors. Extends the standard
 * `Error` class with an `isSpectralError` flag for easy identification
 * when handling errors in component hooks.
 *
 * @see {@link https://prismatic.io/docs/custom-connectors/error-handling/ | Error Handling}
 * @example
 * import { SpectralError } from "@prismatic-io/spectral";
 *
 * throw new SpectralError("Something went wrong during data processing");
 */
export declare class SpectralError extends Error {
    isSpectralError: boolean;
    constructor(message: string);
}
/**
 * An error class for connection-related failures. Includes a reference to
 * the `Connection` object that caused the error, so error handlers can
 * inspect connection details.
 *
 * When thrown, the Prismatic platform will display a "Configuration Error"
 * badge on the instance, signaling that the connection needs attention.
 *
 * @see {@link https://prismatic.io/docs/custom-connectors/error-handling/ | Error Handling}
 * @example
 * import { ConnectionError } from "@prismatic-io/spectral";
 *
 * // Inside an action perform function
 * const myAction = action({
 *   // ...
 *   perform: async (context, { connection }) => {
 *     try {
 *       // Call external API...
 *     } catch (err) {
 *       throw new ConnectionError(connection, "Invalid API credentials");
 *     }
 *   },
 * });
 */
export declare class ConnectionError extends SpectralError {
    connection: Connection;
    constructor(connection: Connection, message: string);
}
/**
 * Type guard to check if an error is a `SpectralError`.
 *
 * @param payload The error to test.
 * @returns True if `payload` is a `SpectralError`, false otherwise.
 * @example
 * import { isSpectralError } from "@prismatic-io/spectral";
 *
 * try {
 *   // ...
 * } catch (err) {
 *   if (isSpectralError(err)) {
 *     console.log("Caught a Spectral error:", err.message);
 *   }
 * }
 */
export declare const isSpectralError: (payload: unknown) => payload is SpectralError;
/**
 * Type guard to check if an error is a `ConnectionError`.
 *
 * @param payload The error to test.
 * @returns True if `payload` is a `ConnectionError`, false otherwise.
 * @example
 * import { isConnectionError } from "@prismatic-io/spectral";
 *
 * try {
 *   // ...
 * } catch (err) {
 *   if (isConnectionError(err)) {
 *     console.log("Connection failed:", err.connection.key, err.message);
 *   }
 * }
 */
export declare const isConnectionError: (payload: unknown) => payload is ConnectionError;
