import { HTTPError } from './http-errors.js'; /** * Type guard to check if a value is an HTTPError instance. * * Performs an `instanceof` check against the HTTPError base class, allowing safe * type narrowing for HTTP error handling without duck-typing or protocol checks. * * @param value - The value to check * @returns `true` if value is an HTTPError instance, `false` otherwise * * @example * ```ts * import { IsHTTPError } from '@pawells/http-common'; * * try { * throw new HTTPNotFoundError('User not found'); * } catch (error) { * if (IsHTTPError(error)) { * console.log(`HTTP ${error.HTTPStatusCode}: ${error.message}`); * } * } * ``` */ export declare function IsHTTPError(value: unknown): value is HTTPError; /** * Type guard to check if a value is an HTTPError with a 4xx (client error) status code. * * Returns true when value is an HTTPError AND its status code is in the 400–499 range. * Enables ergonomic branching on client-error categories without manual range checking. * * @param value - The value to check * @returns `true` if value is an HTTPError with a status code in 400–499, `false` otherwise * * @example * ```ts * import { IsClientError } from '@pawells/http-common'; * * try { * throwSomeError(); * } catch (error) { * if (IsClientError(error)) { * console.log('Client error:', error.message); * // Handle 400–499 errors (bad request, not found, etc.) * } * } * ``` */ export declare function IsClientError(value: unknown): value is HTTPError; /** * Type guard to check if a value is an HTTPError with a 5xx (server error) status code. * * Returns true when value is an HTTPError AND its status code is in the 500–599 range. * Enables ergonomic branching on server-error categories without manual range checking. * * @param value - The value to check * @returns `true` if value is an HTTPError with a status code in 500–599, `false` otherwise * * @example * ```ts * import { IsServerError } from '@pawells/http-common'; * * try { * throwSomeError(); * } catch (error) { * if (IsServerError(error)) { * console.log('Server error:', error.message); * // Handle 500–599 errors (internal server error, bad gateway, etc.) * // Log the full stack and alert the operations team * } * } * ``` */ export declare function IsServerError(value: unknown): value is HTTPError; //# sourceMappingURL=type-guards.d.ts.map