[docs] [issue21227] Decimal class error messages for integer division aren't good

Stefan Krah report at bugs.python.org
Thu Apr 17 00:45:52 CEST 2014


Stefan Krah added the comment:

leewz <report at bugs.python.org> wrote:
> - Error message for `DivisionImpossible` is
>       [<class 'decimal.DivisionImpossible'>]
>   instead of an actual error message.

No, the error message for the *signal*  that is raised (InvalidOperation) lists
the *condition* that triggered the signal (DivisionImpossible).

I followed the recommendation at:

http://speleotrove.com/decimal/daexcep.html#refexcep

"It is recommended that implementations distinguish the different conditions
 listed above, and also provide additional information about exceptional
 conditions where possible (for example, the operation being attempted and
 the values of the operand or operands involved)."

Distinguishing the conditions is easy, adding additional information in
all cases would require changes to libmpdec.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21227>
_______________________________________


More information about the docs mailing list