Skip to main content

Module blossom_error

Module blossom_error 

Source
Expand description

What a Blossom server said when it refused — as data, not prose.

Magnitude answers every refusal three ways at once: X-Error-Code, a stable identifier that is a header so a BUD-06 HEAD preflight carries it too; X-Retry, one of never / later / elsewhere; and a JSON body {error, message, retry, status, ...} whose extra fields hold the numbers behind the sentence (limit, used, retry_after, mime). A server that speaks that vocabulary is routed on it. One that does not falls back to the status-and-keyword heuristics in blossom_capabilities, which is all a plain BUD-02 server gives us to go on.

The difference matters most where the heuristics are wrong in a way only the code can reveal: a quota refusal is a 413, and a 413 read as “the blob is too big” would demote the server for every file of that size for days; an expired signature is a 401, and a 401 read as “this server will never take our uploads” would bury a good server under a clock skew.

Structs§

Refusal
A non-2xx answer to an upload, preflight, or mirror request.

Enums§

Retry
A server’s advice on what to do with a refused request.
UploadFailure
Why one upload attempt did not produce a blob.

Functions§

host_of
The host a server URL names, for messages: magnitude.jskitty.com, not https://magnitude.jskitty.com/.
is_gateway_status
502 / 503 / 504 and the Cloudflare 52x family: the origin behind a proxy cannot ingest the upload, and the next attempt hits the same wall.
summarise_failures
What to tell the user when every server said no.