OpenClaw SDK
    Preparing search index...

    Function createErrorFromResponse

    • Create an error from a response frame error shape.

      Parameters

      • error: { code: string; message: string; retryable?: boolean; details?: unknown }

        The error object from the response frame

      Returns OpenClawError

      Appropriate error instance based on error code

      const frame = await client.request("someMethod");
      if (!frame.ok && frame.error) {
      const error = createErrorFromResponse(frame.error);
      // Throws AuthError, ConnectionError, ProtocolError, RequestError, GatewayError based on code
      }