Repository navigation
Conversation
A backend origin that evaluates to an empty string raises a configuration error per request, but the type was missing from the generated error type set. `error_handler "configuration"` was rejected at startup and a catch-all handler never saw the error, so the empty-origin guard pattern could only reach the client as a generic 500 response. Registering the type for the api and endpoint contexts makes it catchable by name and adds it to the `*` super-type. Closes coupergateway#983
Author
|
Hi — a quick check on this proposal: is it something you would like to take? One thing worth knowing: no workflow has ever run on the branch, so nothing has exercised the change yet. If there is no interest I will go ahead and close it in ten days or so, no worries at all — I would just rather keep the queue here tidy than leave it sitting. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #983.
errors.Configurationwas never registered inerrors.Definitions, so the generator left it out of both thetypesset andSuperTypesMapsByContext. The first omission made a configuration that names it fail at load witherror type is unknown: "configuration"; the second meant the catch-all*— which is expanded into an enumerated subtype list — could not cover it either, so the failure could only reach the client as a generic500.Registering
Configurationin theapiandendpointcontexts and regeneratingerrors/types_generated.gomakes it catchable by name and through*/label-less handlers. The error-type tables indocs/website/content/configuration/error-handling.mdgain the row in both contexts, as the previous commits touchingerrors/type_defintions.godid.Verification
Mutation checks: reverting
errors/makes the new test fail at load with10_couper.hcl:9,19-34: error type is unknown: "configuration"; removing"configuration"from the"*"lists alone turns the wildcard subtest red (want 403, got 500), so both halves are load-bearing.go test ./...has two failures on this machine (gzip/Content-Length,TestBackend_Compression_ModifyAcceptEncodingandTestHTTPServer_NoGzipForSmallContent); they fail identically on the base commit with go 1.27 against the pinned 1.26.9.One thing for review
This makes every per-request
errors.Configurationcatchable inapi/endpoint— not only the empty-origin case — which is a visible change for existing catch-all handlers, anderror_handler "backend"still does not catch it. If configuration errors are meant to hang off thebackendsuper type instead, say so and I will redo it that way. (Unmapped kinds such asevaluation,serverandproxystay uncatchable; that is pre-existing and untouched here.)