Skip to content

Commit

Permalink
Better error on wrong type of config
Browse files Browse the repository at this point in the history
Instead of assertion use more appropriate TypeError with meaningful
error message
  • Loading branch information
anxolerd committed Jun 26, 2017
1 parent 39369a8 commit 6df068c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/blueberrypy/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,15 @@


def get_user_namespace(config, include_pkg=False):
assert isinstance(config, BlueberryPyConfiguration), type(config)
if not isinstance(config, BlueberryPyConfiguration):
raise TypeError(
'Expected config to be {expected_type}, '
'but got {actual_type}'
.format(
expected_type=BlueberryPyConfiguration,
actual_type=type(config),
)
)

ns = {'__name__': 'blueberrypy-shell'}

Expand Down

0 comments on commit 6df068c

Please sign in to comment.