Skip to content

Commit 85aad77

Browse files
authored
Improve clarity of 'content' error message (#1278)
1 parent 3fda85a commit 85aad77

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

slack_sdk/web/internal_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,12 +317,12 @@ def _to_v2_file_upload_item(upload_file: Dict[str, Any]) -> Dict[str, Optional[A
317317
else:
318318
data = file
319319
elif content is not None:
320-
if isinstance(content, str): # filepath
320+
if isinstance(content, str):
321321
data = content.encode("utf-8")
322322
elif isinstance(content, bytes):
323323
data = content
324324
else:
325-
raise SlackRequestError("The given content must be either filepath as str or data as bytes")
325+
raise SlackRequestError("content for file upload must be 'str' (UTF-8 encoded) or 'bytes' (for data)")
326326

327327
filename = upload_file.get("filename")
328328
if upload_file.get("filename") is None and isinstance(file, str):

0 commit comments

Comments
 (0)