From 66b7037cc2e22296180d1f5663dcbe9b2f5ac59d Mon Sep 17 00:00:00 2001 From: disqualifier Date: Mon, 6 Jul 2026 21:02:02 -0400 Subject: [PATCH] docs: correct cache() docstring exception types to match the code the docstring listed an unsupported content type under DPYCacheError, but _normalize/ _prevalidate raise ValueError for it (DPYCacheError is only the duplicate-filename and missing-path cases). a caller following the docstring with except DPYCacheError would let the ValueError escape. group the raises correctly: ValueError = unnamed bytes / unsupported type; DPYCacheError = duplicate filename / missing path / count mismatch. doc-only. Signed-off-by: disqualifier --- src/dpy_cache/dpy_cache.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/dpy_cache/dpy_cache.py b/src/dpy_cache/dpy_cache.py index 9b3ba99..9f41f0f 100644 --- a/src/dpy_cache/dpy_cache.py +++ b/src/dpy_cache/dpy_cache.py @@ -121,12 +121,12 @@ class DPYCache: content: "str | None" = None, ) -> CacheResult: """upload files to the storage channel (batching over 10/message) and return refs - keyed by original filename; raises ValueError on unnamed bytes in a list input, - DPYCacheError on a duplicate filename in a list input, an unsupported content type, - or a missing file path (all checked before any upload, so a locally-detectable bad - input in a >10-file batch costs zero requests and orphans nothing), or an - attachment-count mismatch after a send, and propagates discord's own - Forbidden/HTTPException unwrapped on a send failure""" + keyed by original filename; raises ValueError on unnamed bytes in a list input or an + unsupported content type, DPYCacheError on a duplicate filename in a list input or a + missing file path (all checked before any upload, so a locally-detectable bad input + in a >10-file batch costs zero requests and orphans nothing) or an attachment-count + mismatch after a send, and propagates discord's own Forbidden/HTTPException unwrapped + on a send failure""" items = self._normalize(files) self._prevalidate(items) merged: dict[str, FileRef] = {}