Function parse_error_message

  • Parse simple message string from HTTP JSON response, GraphQL, or Error() object

    Too many libraries to fetch HTTP requests, too many non-standard response formats. This handles Axios or standard XMLHTTPRequest, or an Error() object Supports either convention, of Twitter or Facebook Supports "non-legacy" format described in: Response and parsed error can be any type. This will figure it out, with just a few if/else rules.

    WARNING: This should NOT be used to detect if a variable is an error. It will be very slow. Only use this to parse the message string from some object/response which you know contains an error message.


    • nice readable text - to render in an alert popup in your front-end user interface


    • response: string | Record<string, any>

      response from HTTP request or Error object

    Returns string

Generated using TypeDoc