Skip to content

Commit 872665b

Browse files
authored
Merge pull request scrapinghub#140 from scrapinghub/Gallaecio-patch-1
parse_job_key: Improve ValueError messages
2 parents 32b7c04 + 3441c1a commit 872665b

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

scrapinghub/client/utils.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,17 @@ def parse_job_key(job_key):
5656
elif isinstance(job_key, six.string_types):
5757
parts = job_key.split('/')
5858
else:
59-
raise ValueError("Job key should be a string or a tuple")
59+
raise ValueError("Job key should be a string or a tuple, got {}: {}"
60+
.format(type(job_key), repr(job_key)))
6061
if len(parts) != 3:
6162
raise ValueError(
62-
"Job key should consist of project_id/spider_id/job_id")
63+
"Job key should consist of project_id/spider_id/job_id, got {}"
64+
.format(repr(job_key)))
6365
try:
6466
list(map(int, parts))
6567
except ValueError:
66-
raise ValueError("Job key parts should be integers")
68+
raise ValueError("Job key parts should be integers, got {}"
69+
.format(repr(job_key)))
6770
return JobKey(*map(str, parts))
6871

6972

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy