Raise informative errors for failed Fastly purges#138
Merged
Conversation
A purge of the private docs service started failing with a 404 "Cannot
find service" response from the Fastly API, which surfaced as a bare
MatchError. Turn non-200 purge responses into an error message that
includes the service name, service id, status, and response body.
The MatchError also exposed a bug in Queue.run_in_task/1: task exit
reasons like {:badmatch, value} are not exceptions, so passing them to
reraise/2 raised ArgumentError and masked the original error. Only
reraise when the exit reason is an exception, otherwise exit with the
original reason.
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.
Purges of the private docs service started failing after #137 went out, surfacing as a bare
MatchErroron the Fastly API's 404 response:The root cause was the Fastly API token being scoped to services that didn't include the new docs-private compute service (fixed separately in hexpm-ops by rotating the token). This PR improves how hexdocs surfaces such failures:
MatchErroron the raw response tuple.Queue.run_in_task/1: task exit reasons like{:badmatch, value}are not exceptions, so passing them toreraise/2raisedArgumentError: raise/1 and reraise/2 expect a module name, string or exceptionand masked the original error. Exit reasons are now only reraised when they are actual exceptions; anything else exits with the original reason so the real failure is reported.