Skip to content

Commit

Permalink
Rearrange error handling
Browse files Browse the repository at this point in the history
Co-authored-by: Andrew Murray <[email protected]>
  • Loading branch information
nik012003 and radarhere authored Jan 27, 2024
1 parent 1522b3f commit 6998f34
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/PIL/ImageGrab.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,9 @@ def grabclipboard():
err = p.stderr
if any(e in err for e in allowed_errors):
return None
msg = f"{args[0]} error: {err.strip().decode() if err else 'Unknown error'}"
msg = f"{args[0]} error"
if err:
msg += f": {err.strip().decode()}"
raise ChildProcessError(msg)

data = io.BytesIO(p.stdout)
Expand Down

0 comments on commit 6998f34

Please sign in to comment.