Closed
Bug 465863
Opened 16 years ago
Closed 16 years ago
[silme] Improve exception handling in io.file.py
Categories
(Mozilla Localizations :: Infrastructure, defect)
Mozilla Localizations
Infrastructure
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: adriank, Assigned: adriank)
References
Details
Attachments
(1 file)
3.01 KB,
patch
|
zbraniecki
:
review+
|
Details | Diff | Splinter Review |
We have some problems with the exception handling in silme.io.file. The submitted patch fixes: -don't fall silently on every possible exception -fix raising UnicodeDecodeError (it's causing a TypeError at the moment) -add TODOs for exceptions that should be logged in the future (after the silme.core.logging lands)
Comment 1•16 years ago
|
||
Comment on attachment 349096 [details] [diff] [review] patch v1 >diff --git a/lib/silme/io/file.py b/lib/silme/io/file.py >--- a/lib/silme/io/file.py >+++ b/lib/silme/io/file.py > @classmethod > def getSourceWithEncoding(cls, path, encoding): > try: > f = codecs.open(path, 'rU', encoding=encoding) > text = f.read() > except UnicodeDecodeError, e: >- raise UnicodeDecodeError(path + ': ' + str(e)) >+ raise UnicodeDecodeError, e > except IOError, e: > raise IOError(path + ': ' + str(e)) why do you remove path here? except of this it looks good.
Assignee | ||
Comment 2•16 years ago
|
||
Gandalf: because you cannot raise a UnicodeDecodeError with only one argument. If you don't do that with exactly 5 arguments, it'll raise a TypeError.
Assignee | ||
Updated•16 years ago
|
Attachment #349096 -
Flags: review?(gandalf)
Updated•16 years ago
|
Attachment #349096 -
Flags: review?(gandalf) → review+
Comment 3•16 years ago
|
||
commited
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•