[Python-ideas] Comparable exceptions (original) (raw)
Yawar Amin yawar.amin at gmail.com
Sat Feb 28 21:15:26 CET 2015
- Previous message: [Python-ideas] Comparable exceptions
- Next message: [Python-ideas] Show deprecation warnings in the interactive interpreter
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi,
On 2015-02-25 08:03, Ionel Cristian Mrie wrote:
Yes, it does, however my assertion looks similar to this:
assert result == [1,2, (3, 4, {"bubu": OSError('foobar')})]
How about reifying the error? I.e., instead of storing the OSError object, you wrap up the error info ('foobar') in a custom Result (e.g.) object that you implement your own comparison for? Then, instead of allowing your function to raise and exception, you catch the exception and wrap its data in a Result object?
Regards,
Yawar
-------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 834 bytes Desc: OpenPGP digital signature URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150228/efed0afd/attachment.sig>
- Previous message: [Python-ideas] Comparable exceptions
- Next message: [Python-ideas] Show deprecation warnings in the interactive interpreter
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]