Skip to content

Raise informative errors for failed Fastly purges#138

Merged
ericmj merged 2 commits into
mainfrom
fastly-purge-key-error
Jul 5, 2026
Merged

Raise informative errors for failed Fastly purges#138
ericmj merged 2 commits into
mainfrom
fastly-purge-key-error

Conversation

@ericmj

@ericmj ericmj commented Jul 5, 2026

Copy link
Copy Markdown
Member

Purges of the private docs service started failing after #137 went out, surfacing as a bare MatchError on the Fastly API's 404 response:

MatchError: no match of right hand side value: {:ok, 404, [...], %{"detail" => "Cannot find service", "msg" => "Record not found"}}

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:

  • Non-200 purge responses now raise an error that includes the service name, service id, status, and response body, instead of a MatchError on the raw response tuple.
  • Fixes 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: raise/1 and reraise/2 expect a module name, string or exception and 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.

claude added 2 commits July 5, 2026 15:49
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.
@ericmj ericmj merged commit 54fb2e7 into main Jul 5, 2026
8 checks passed
@ericmj ericmj deleted the fastly-purge-key-error branch July 5, 2026 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants