friendly-traceback / friendly

Friendly-traceback's version used in most situations
https://friendly-traceback.github.io/docs/index.html
MIT License
42 stars 5 forks source link

Custom exceptions #16

Closed aroberge closed 2 years ago

aroberge commented 3 years ago

Discussed in https://github.com/friendly-traceback/friendly/discussions/15

Originally posted by **aroberge** October 18, 2021 ## Background On Twitter (https://twitter.com/willmcgugan/status/1450097933169405956), Will McGugan suggested the following: Regarding exceptions, wouldn't it be great if: a) the exception rendered a brief piece of markdown with a description of the problem. b) gave you a link to a web service with a more detailed error. c) proposed a solution He indicated later that this was for exceptions in a custom project. friendly already attempts to do something like a) and c) for an ever growing number of cases for standard Python exceptions. It can either give the information all at once, or breaking it up (in an interactive session) as answers to the questions "what" (for part a) and "why" (for part c). Internally, the answer to "what" is known as the "generic" explanation, and the answer to "why" is known as the "specific" explanation. friendlyhas also a `www()` function that can open up a browser at some predetermined locations. friendly uses markdown, processed by Rich (https://github.com/willmcgugan/rich). The following screenshot is a concrete example. ![image](https://user-images.githubusercontent.com/629698/137814982-783b1d50-7836-46e0-931d-b24a62b4125e.png) In addition, friendly support translation for these explanations; currently only English and French are the only two language supported. ## Comments welcome Feel free to contribute to the discussion at https://github.com/friendly-traceback/friendly/discussions/15.

This issue will be used to keep track of an actual implementation.

aroberge commented 2 years ago

Closing: most likely made irrelevant with PEP 678Enriching Exceptions with Notes.