Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config loading - Display specific error message instead of the same error every time on failure #162

Merged
merged 1 commit into from
Dec 10, 2019

Conversation

cham11ng
Copy link
Contributor

@cham11ng cham11ng commented Dec 10, 2019

Description

Log an exception error instead of same custom error message

Cases:

  • boss.yml file not found.
[Errno 2] No such file or directory: 'boss.yml'
  • Invalid vault address is set.
Invalid URL 'test/v1/app/dev': No schema supplied. Perhaps you meant http://test/v1/app/dev?

Enable DEBUG flag

$ DEBUG=true fab dev build
Traceback (most recent call last):
  File "/Users/cham11ng/Source/boss/venv/lib/python2.7/site-packages/boss/config.py", line 104, in load
    use_vault_if_enabled(config_str, stage)
  File "/Users/cham11ng/Source/boss/venv/lib/python2.7/site-packages/boss/config.py", line 171, in use_vault_if_enabled
    vault.env_inject_secrets(path, silent=raw_config['vault']['silent'])
  File "/Users/cham11ng/Source/boss/venv/lib/python2.7/site-packages/boss/core/vault.py", line 65, in env_inject_secrets
    secrets = read_secrets(path)
  File "/Users/cham11ng/Source/boss/venv/lib/python2.7/site-packages/boss/core/vault.py", line 35, in read_secrets
    result = client.read(path)
  File "/Users/cham11ng/Source/boss/venv/lib/python2.7/site-packages/hvac/v1/__init__.py", line 157, in read
    return self._adapter.get('/v1/{0}'.format(path), wrap_ttl=wrap_ttl).json()
  File "/Users/cham11ng/Source/boss/venv/lib/python2.7/site-packages/hvac/adapters.py", line 90, in get
    return self.request('get', url, **kwargs)
  File "/Users/cham11ng/Source/boss/venv/lib/python2.7/site-packages/hvac/adapters.py", line 219, in request
    allow_redirects=False, **_kwargs)
  File "/Users/cham11ng/Source/boss/venv/lib/python2.7/site-packages/requests/sessions.py", line 510, in request
    prep = self.prepare_request(req)
  File "/Users/cham11ng/Source/boss/venv/lib/python2.7/site-packages/requests/sessions.py", line 453, in prepare_request
    hooks=merge_hooks(request.hooks, self.hooks),
  File "/Users/cham11ng/Source/boss/venv/lib/python2.7/site-packages/requests/models.py", line 313, in prepare
    self.prepare_url(url, params)
  File "/Users/cham11ng/Source/boss/venv/lib/python2.7/site-packages/requests/models.py", line 387, in prepare_url
    raise MissingSchema(error)
MissingSchema: Invalid URL 'test/v1/app/dev': No schema supplied. Perhaps you meant http://test/v1/app/dev?

Copy link
Owner

@kabirbaidhya kabirbaidhya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks @cham11ng 👍

@kabirbaidhya kabirbaidhya changed the title Log an exception error instead of same custom error message Config loading - Display specific error message instead of the same error every time on failure Dec 10, 2019
@kabirbaidhya kabirbaidhya merged commit 10fc7c1 into kabirbaidhya:master Dec 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants