![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Pretty-Exception for Python
.. image:: https://travis-ci.org/youknowone/prettyexc.svg?branch=master
:target: https://travis-ci.org/youknowone/prettyexc
prettyexc provides common exception representation to make human-readable exception in easy way.
You can install the package from PyPI
$ pip install prettyexc
Example
-------
Prelude::
>>> from prettyexc import PrettyException
Put and get your arguments always::
>>> class SimpleException(PrettyException):
... pass
...
>>> e = SimpleException('any', 'plain', 'args', code=200, description='OK')
>>> raise e
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
__main__.SimpleException: "any","plain","args",code=200,description="OK"
SimpleException("any","plain","args",code=200,description="OK")
>>> print [e, e]
[<SimpleException("any","plain","args",code=200,description="OK")>, <SimpleException("any","plain","args",code=200,description="OK")>]
Set default message::
>>> class MessageException(PrettyException):
... message = u'You should select a user'
...
>>> e = MessageException(user_id=10)
>>> raise e
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
__main__.MessageException: You should select a user
>>> print [e, e]
[<MessageException(user_id=10)>, <MessageException(user_id=10)>]
Set message formatter::
>>> class FormatException(PrettyException):
... message_format = u'User {user_id} has no permission.'
...
>>> e = FormatException(user_id=10)
>>> raise e
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
__main__.FormatException: User 10 has no permission.
>>> print e.message
User 10 has no permission.
Patch existing exceptions::
>>> from prettyexc import patch
>>> class AnException(Exception): pass
...
>>> patch(AnException, PrettyException)
>>> raise AnException(status=404)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
__main__.AnException: status=404
FAQs
Toolkit for human-friendly exception interface.
We found that prettyexc demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.