Skip to content

Commit c4d8f84

Browse files
committed
Be more explicit in byte_to_int errors
1 parent 53e0f0c commit c4d8f84

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

javaobj/modifiedutf8.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@ def byte_to_int(data):
4646
if isinstance(data, bytes):
4747
return data[0]
4848

49-
raise ValueError("Didn't get a byte as input")
49+
raise ValueError(
50+
"Expected byte or int as input, got: {0}".format(
51+
type(data).__name__
52+
)
53+
)
5054

5155

5256
else:
@@ -65,7 +69,11 @@ def byte_to_int(data):
6569
if isinstance(data, str):
6670
return ord(data[0])
6771

68-
raise ValueError("Didn't get a byte as input")
72+
raise ValueError(
73+
"Expected byte or int as input, got: {0}".format(
74+
type(data).__name__
75+
)
76+
)
6977

7078

7179
# ------------------------------------------------------------------------------

0 commit comments

Comments
 (0)