Lime Web Components API Documentation - v6.24.0
    Preparing search index...

    Interface HttpResponseError

    Error thrown when an HTTP request fails

    This error is thrown by HttpClient methods when the server responds with an error status code (4xx or 5xx).

    const http = platform.get(PlatformServiceName.Http);

    try {
    const data = await http.get('my_addon/data');
    } catch (error) {
    if (error.name !== 'HttpResponseError') {
    throw error;
    }

    if (error.status === 404) {
    console.error('Resource not found');
    } else if (error.status >= 500) {
    console.error('Server error:', error.status);
    }

    const body = await error.response.text();
    console.error('Response body:', body);
    }
    interface HttpResponseError {
        cause?: unknown;
        message: string;
        name: "HttpResponseError";
        response: Response;
        stack?: string;
        status: number;
    }

    Hierarchy

    • Error
      • HttpResponseError
    Index

    Properties

    cause?: unknown
    message: string
    name: "HttpResponseError"
    response: Response

    The full Response object from the failed request

    Use this to access response headers or read the response body:

    const body = await error.response.text();
    const contentType = error.response.headers.get('content-type');
    stack?: string
    status: number

    HTTP status code from the failed response