feat: map DownloadCacheError via dunite ErrorClass in member-download handler (BUNYIP-48) #57
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/bunyip-48-download-errorclass"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Adopt dunite-download's
DownloadCacheError::class() -> ErrorClass(PSA-38) in the member-download handler, replacing the hand-rolled match onDownloadCacheErrorvariants.Correction to the premise
BUNYIP-48 was filed assuming no member-download handler existed. It does:
download_assetinbunyip-api/src/handlers/download.rsis fully implemented and wired (GET /v1/applications/{slug}/downloads/{asset_name}). It hand-rolled the error classification, with a comment already noting "PSA-38 tracks moving this classification into dunite-download." So this is the original small adoption, not a new feature.Change
ErrorClassfrombunyip-domain's services (next toDownloadCacheError).download_asset, classify theget_or_fetcherror viae.class()instead of matching variants:NotFound-> 404, no upstream-failure audit (permanent missing-asset path)Upstream-> 502 +DownloadFailedUpstreamaudit + warn logLocal-> 500 +DownloadFailedUpstreamaudit + error logDownloadCacheError/ForgejoErrorimports.Behaviour is unchanged - same statuses, same audit events, same per-class logging (the error's
Displaystill names the underlying variant in logs/audit). The classification policy now lives next to the type in dunite and cannot drift across consumers.Acceptance criteria
bunyip-domainre-exportsErrorClassnext toDownloadCacheError.err.class()(NotFound -> 404, Upstream -> 502, Local -> 500); no direct match onDownloadCacheErrorvariants.Displayis logged/audited server-side; the client response carries no internal detail.Verification
just check-containergreen: fmt + clippy -D warnings +cargo test --workspace --lib(205 lib tests).#BUNYIP-48