Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeEmbeddedJSON ¶
DecodeEmbeddedJSON scans text for an embedded JSON object (e.g. an error response body copied verbatim into an error message by an upstream library) or a bare JSON-encoded string containing Unicode escape sequences, and replaces it with a decoded, human-readable representation.
This is useful for error messages produced by libraries (such as go-git) that include a remote server's raw response body as-is, which can contain visible "\uXXXX" escape sequences instead of readable UTF-8 text when the upstream server is localized (e.g. a non-English Azure DevOps Server).
If no embedded JSON is found, or it cannot be parsed into a meaningful representation, the original text is returned unchanged.
func FormatErrorResponseBody ¶
FormatErrorResponseBody formats the response body into a human-readable string. It returns two strings: the first is the raw body text, and the second is a structured representation of the error details if the body is in JSON format. If the body is empty or cannot be parsed, both strings will be empty.
Types ¶
This section is empty.