Opened 8 years ago

Closed 6 years ago

#25 closed defect (fixed)

Raise exceptions in exporters instead of returning errors

Reported by: olivier Owned by: yomguy
Priority: major Milestone: 0.4
Component: Export Version:
Keywords: Cc:


In many places, you return or yield error strings from the exporters methods. These errors can't be properly caught by the Python error handling mechanism, and it result in silent failures. In Python (and other OO language), you don't return errors, you must raise exceptions.

More about exceptions:

Change History (5)

comment:1 Changed 8 years ago by olivier

  • Owner set to yomguy

comment:2 Changed 8 years ago by anonymous

In r126, I see you call raise with strings... This isn't right. String exceptions are a bad practice, they can't be properly caught and are deprecated in Python 2.5.

Please use class exceptions, as explained in "8.4 Raising Exceptions" and "8.5 User-defined Exceptions", in the tutorial page I mention in my report.

comment:3 Changed 8 years ago by olivier

By the way, if you need to define custom ("User-defined") exceptions, you should put the class definitions in export/, so that one knows what exceptions to expect from the export package, what specific attributes these exceptions carry, etc..

comment:4 Changed 6 years ago by yomguy

  • Milestone set to 0.4

comment:5 Changed 6 years ago by yomguy

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.