{ "info": { "author": "J\u00fcrgen Knauth", "author_email": "pubsrc@binary-overflow.de", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "License :: OSI Approved :: Apache Software License", "Topic :: Software Development :: Testing" ], "description": "jk_exceptionhelper\n==================\n\nIntroduction\n------------\n\nThis python module wraps around python exceptions. As the python exception API is quite a bit obscure this python module provides a clean API for analysis and logging purposes.\n\nInformation about this module can be found here:\n\n* [github.org](https://github.com/jkpubsrc/....)\n* [pypi.python.org](https://pypi.python.org/pypi/jk_exceptionhelper)\n\nWhy this module?\n----------------\n\nAs the python exception API is quite a bit obscure this python module tries to solve this problem. By focusing on this problem in an isolated way improvements can easily be made without breaking and adapting a variety of implementations.\n\nHow to use this module\n----------------------\n\n### Import this module\n\nPlease include this module into your application using the following code:\n\n```python\nimport jk_exceptionhelper\n```\n\n### Analyse the exeption\n\nExample:\n\ntry:\n\ta = 0\n\tb = 5 / a\nexcept:\n\tee = jk_exceptionhelper.analyseException()\n\nNow `ee` contains an instance of `ExceptionObject`. `ExceptionObject` contains all relevant information from the exception for your convenience to work with. (For details about the `ExceptionObject` API see below.)\n\n### Output the exception data\n\nExample:\n\ntry:\n\ta = 0\n\tb = 5 / a\nexcept:\n\tjk_exceptionhelper.analyseException().dump()\n\n...\n\nAPI: Functions\n--------------\n\n### Function `analyseException()`\n\n`ExceptionObject analyseException()`\n\nThis function should be called at the first statement within an `except` block. It returns an object of type `ExceptionObject` containing all relevant information from the exception for your convenience to work with.\n\nAPI: Classes\n------------\n\n## Class 'ExceptionObject'\n\n### Fields\n\n| Type\t| Name\t| Required?\t| Description\t|\n| ----- | ----- | --------- | ------------- |\n| `class`\t\t\t\t| `exceptionClass`\t\t| optional\t| The original exception class. This instance will only be present if `analyseException()` was called within an `except` block.\t|\n| `str`\t\t\t\t\t| `exceptionClassName`\t| required\t| The class name of the exception.\t\t\t\t\t\t\t\t\t\t\t\t\t\t|\n| `str`\t\t\t\t\t| `exceptionTextHR`\t\t| optional\t| A human readable text that was contained within the exception.\t\t\t\t\t\t|\n| `StackTraceItem[]`\t| `stackTrace`\t\t\t| optional\t| The stack trace. The last item of the list is the topmost stack element.\t\t\t\t|\n| `ExceptionObject`\t\t| `nestedException`\t\t| optional\t| The parent exception object if this exception has been caught in an `except` block.\t|\n\n### Static Methods\n\n#### Static Method `StackTraceItem fromJSON(dict data)`\n\n`StackTraceItem fromJSON(dict data)`\n\nDeserialize a data structure created by `toJSON()`.\n\n### Methods\n\n#### Method `void dump()`\n\n`void dump()`\n\nPrint the contents of the exception to STDOUT.\n\nExample:\n\n```python\ntry:\n\ta = 0\n\tb = 5 / a\nexcept:\n\tanalyseException().dump()\n```\n\nThis will print:\n\n```\nZeroDivisionError\n: exceptionTextHR:\n:\tdivision by zero\n: stackTrace:\n:\t(./test2.py:55, 'b = 5 / a')\n:\t(./test2.py:59, 'main3()')\n:\t(./test2.py:63, 'main2()')\n:\t(./test2.py:67, 'main1()')\n```\n\n#### Method `dict toJSON(bool bRecursive = True)`\n\n`dict toJSON(bool bRecursive = True)`\n\nSerialize the exception object to JSON format.\n\nArguments:\n\n* `bool bRecursive` : If `True` (which is the default) nested exceptions are serialized as well. If `False` these get skipped.\n\nExample:\n\n```python\ntry:\n\ta = 0\n\tb = 5 / a\nexcept:\n\tedata = analyseException().toJSON()\n```\n\n#### Method `dict toJSON(bool bRecursive = True)`\n\n`dict toJSON_flat()`\n\nSame as `toJSON(False)`.\n\nArguments:\n\n* (none)\n\nContact Information\n-------------------\n\nThis is Open Source code. That not only gives you the possibility of freely using this code it also\nallows you to contribute. Feel free to contact the author(s) of this software listed below, either\nfor comments, collaboration requests, suggestions for improvement or reporting bugs:\n\n* J\u00fcrgen Knauth: jknauth@uni-goettingen.de, pubsrc@binary-overflow.de\n\nLicense\n-------\n\nThis software is provided under the following license:\n\n* Apache Software License 2.0", "description_content_type": "text/markdown", "docs_url": null, "download_url": "https://github.com/jkpubsrc/python-module-jk-exceptionhelper/tarball/0.2019.9.30", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/jkpubsrc/python-module-jk-exceptionhelper", "keywords": "exception handling,debugging", "license": "Apache 2.0", "maintainer": "", "maintainer_email": "", "name": "jk-exceptionhelper", "package_url": "https://pypi.org/project/jk-exceptionhelper/", "platform": "", "project_url": "https://pypi.org/project/jk-exceptionhelper/", "project_urls": { "Download": "https://github.com/jkpubsrc/python-module-jk-exceptionhelper/tarball/0.2019.9.30", "Homepage": "https://github.com/jkpubsrc/python-module-jk-exceptionhelper" }, "release_url": "https://pypi.org/project/jk-exceptionhelper/0.2019.9.30/", "requires_dist": null, "requires_python": "", "summary": "As the python exception API is quite a bit obscure this python module wraps around python exceptions to provide a clean interface for analysis and logging purposes.", "version": "0.2019.9.30" }, "last_serial": 5907554, "releases": { "0.2019.9.30": [ { "comment_text": "", "digests": { "md5": "c0917eadbbea6b1b374f9186f153c3ba", "sha256": "b42a2e7c8dedd81e7ca74b79a7a6e41670a3d7db4ef95940411b69a628c7ae01" }, "downloads": -1, "filename": "jk_exceptionhelper-0.2019.9.30.tar.gz", "has_sig": false, "md5_digest": "c0917eadbbea6b1b374f9186f153c3ba", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9036, "upload_time": "2019-09-30T15:32:07", "url": "https://files.pythonhosted.org/packages/39/1b/c42a9a7cd0e7ae66e9a410087cac43c3fbecfadfb54c26f99850aead5daa/jk_exceptionhelper-0.2019.9.30.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c0917eadbbea6b1b374f9186f153c3ba", "sha256": "b42a2e7c8dedd81e7ca74b79a7a6e41670a3d7db4ef95940411b69a628c7ae01" }, "downloads": -1, "filename": "jk_exceptionhelper-0.2019.9.30.tar.gz", "has_sig": false, "md5_digest": "c0917eadbbea6b1b374f9186f153c3ba", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9036, "upload_time": "2019-09-30T15:32:07", "url": "https://files.pythonhosted.org/packages/39/1b/c42a9a7cd0e7ae66e9a410087cac43c3fbecfadfb54c26f99850aead5daa/jk_exceptionhelper-0.2019.9.30.tar.gz" } ] }