Skip to content

Commit

Permalink
Merge pull request #80 from chrysn-pull-requests/error-reporting-enha…
Browse files Browse the repository at this point in the history
…ncements-noassert

Error reporting enhancements (conditional-raise-instead-of-assert version)
  • Loading branch information
RecursiveForest authored Dec 15, 2016
2 parents a443f30 + f9af58e commit d455b77
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions morituri/image/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,9 @@ def stop(self):
self.setException(taskk.exception)
break

if taskk.length is None:
raise ValueError("Track length was not found; look for "
"earlier errors in debug log (set RIP_DEBUG=4)")
# print '%d has length %d' % (trackIndex, taskk.length)
index = track.indexes[1]
assert taskk.length % common.SAMPLES_PER_FRAME == 0
Expand Down
5 changes: 4 additions & 1 deletion morituri/rip/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ def main():
'rip: error: Could not create encoded file.\n')
return 255

raise
# in python3 we can instead do `raise e.exception` as that would show
# the exception's original context
sys.stderr.write(e.exceptionMessage)
return 255
except command.CommandError, e:
sys.stderr.write('rip: error: %s\n' % e.output)
return e.status
Expand Down

0 comments on commit d455b77

Please sign in to comment.