@metreeca/core - v0.9.19
    Preparing search index...

    Module problem

    RFC 9457 problem details for HTTP APIs.

    Provides the Problem type for structured, machine-readable error information in HTTP responses and a guarded createFetch wrapper with consistent promise semantics.

    Problem Details

    import { Problem } from "@metreeca/core/problem";

    const problem: Problem = {
    status: 404,
    title: "Not Found",
    detail: "Resource /api/users/123 does not exist",
    instance: "/api/users/123",
    report: { timestamp: "2025-12-02T10:30:00Z" }
    };

    Guarded Fetch

    import { createFetch } from "@metreeca/core/problem";

    const guard = createFetch(fetch);

    try {
    const response = await guard("https://api.example.com/data");
    // response.ok is guaranteed true
    } catch (problem) {
    // problem is a Problem with parsed error details
    console.error(problem.status, problem.detail, problem.report);
    }

    Functions

    createFetch

    Creates a fetch function with consistent promise resolution/rejection behaviour.

    Interfaces

    Problem

    Problem Details for HTTP APIs.