Format the exception part of a traceback. The return value is a list of strings, each ending in a newline. The list contains the exception's message, which is normally a single string; however, for :exc:`SyntaxError` exceptions, it contains several lines that (when printed) d
(exc, /, value=_sentinel)
| 141 | |
| 142 | |
| 143 | def format_exception_only(exc, /, value=_sentinel): |
| 144 | """Format the exception part of a traceback. |
| 145 | |
| 146 | The return value is a list of strings, each ending in a newline. |
| 147 | |
| 148 | The list contains the exception's message, which is |
| 149 | normally a single string; however, for :exc:`SyntaxError` exceptions, it |
| 150 | contains several lines that (when printed) display detailed information |
| 151 | about where the syntax error occurred. Following the message, the list |
| 152 | contains the exception's ``__notes__``. |
| 153 | """ |
| 154 | if value is _sentinel: |
| 155 | value = exc |
| 156 | te = TracebackException(type(value), value, None, compact=True) |
| 157 | return list(te.format_exception_only()) |
| 158 | |
| 159 | |
| 160 | # -- not official API but folk probably use these two functions. |
no test coverage detected