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,
|
content: "str | None" = None,
|
||||||
) -> CacheResult:
|
) -> CacheResult:
|
||||||
"""upload files to the storage channel (batching over 10/message) and return refs
|
"""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,
|
keyed by original filename; raises ValueError on unnamed bytes in a list input or an
|
||||||
DPYCacheError on a duplicate filename in a list input, an unsupported content type,
|
unsupported content type, DPYCacheError on a duplicate filename in a list input or a
|
||||||
or a missing file path (all checked before any upload, so a locally-detectable bad
|
missing file path (all checked before any upload, so a locally-detectable bad input
|
||||||
input in a >10-file batch costs zero requests and orphans nothing), or an
|
in a >10-file batch costs zero requests and orphans nothing) or an attachment-count
|
||||||
attachment-count mismatch after a send, and propagates discord's own
|
mismatch after a send, and propagates discord's own Forbidden/HTTPException unwrapped
|
||||||
Forbidden/HTTPException unwrapped on a send failure"""
|
on a send failure"""
|
||||||
items = self._normalize(files)
|
items = self._normalize(files)
|
||||||
self._prevalidate(items)
|
self._prevalidate(items)
|
||||||
merged: dict[str, FileRef] = {}
|
merged: dict[str, FileRef] = {}
|
||||||
|
|||||||
Reference in New Issue
Block a user