Files
docker-agent/pkg/modelerrors
David Gageot 634dfc81fe refactor(modelerrors): simplify provider error parsing
Same behaviour, less code, easier to read:

  * StatusError.Error()    14 -> 9 lines (request-id concat moved into

                           parseProviderError, no second branch here)

  * extractFirstJSONObject  35 -> 9 lines, renamed firstJSONObject:

                           replace the hand-rolled brace/string/escape

                           state machine with json.Decoder, which

                           handles escapes correctly by construction

  * parseProviderErrorDetails split into two single-purpose helpers:

      - parseProviderError    finds the JSON body, parses it, appends

                              the request id to the rendered details

      - formatProviderError   renders the parsed struct as a one-liner

  * unquoteJSONScalar      renamed scalarString and switched to plain

                           any/float64 instead of json.RawMessage +

                           per-scalar json.Unmarshal calls

All existing tests still pass unchanged; lint clean.

Assisted-By: docker-agent
2026-04-27 18:05:42 +02:00
..