Skip to content

Commit 0c16ede

Browse files
authored
Improve advice on when to file bug (#266)
Closes #262
1 parent f7cb4d1 commit 0c16ede

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

spin/__main__.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import collections
22
import importlib
33
import importlib.util
4+
import inspect
45
import os
56
import pathlib
67
import sys
78
import textwrap
8-
import traceback
99
from typing import Union
1010

1111
import click
@@ -199,20 +199,26 @@ def group(ctx):
199199

200200
try:
201201
group()
202-
except Exception:
203-
click.secho("\n" + traceback.format_exc(limit=-3), fg="red", file=sys.stderr)
202+
except Exception as e:
204203
click.secho(
205204
textwrap.dedent(
206205
f"""\
207-
An internal error has occurred. Please file a bug report at
208206
209-
https://github.com/scientific-python/spin
207+
{type(e).__name__}: {e}
210208
211-
including the above traceback and the following information:
209+
This exception was raised from:
212210
213-
spin: {__version__}, package: {proj_name}
211+
{inspect.trace()[-1].filename}
214212
215-
Aborting."""
213+
If you suspect this is a bug in `spin`, please file a report at:
214+
215+
https://github.com/scientific-python/spin
216+
217+
including the above traceback and the following information:
218+
219+
spin: {__version__}, package: {proj_name}
220+
221+
Aborting."""
216222
),
217223
fg="red",
218224
bold=True,

0 commit comments

Comments
 (0)