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 <dev@disqualifier.me>
This commit is contained in:
@@ -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] = {}
|
||||
|
||||
Reference in New Issue
Block a user