-
-
Notifications
You must be signed in to change notification settings - Fork 318
[bug] Error handling on dynaconf get CLI #959
Copy link
Copy link
Closed
Description
Describe the bug
When using get to read a non existent variable it outputs the python traceback to the CLI
To Reproduce
$ dynaconf get DONTEXIST
Traceback (most recent call last):
File "/venv/bin/dynaconf", line 8, in <module>
sys.exit(main())
File "/src/dynaconf/dynaconf/vendor/click/core.py", line 857, in __call__
return self.main(*args, **kwargs)
File "/src/dynaconf/dynaconf/vendor/click/core.py", line 810, in main
rv = self.invoke(ctx)
File "/src/dynaconf/dynaconf/vendor/click/core.py", line 1292, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/src/dynaconf/dynaconf/vendor/click/core.py", line 1099, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/src/dynaconf/dynaconf/vendor/click/core.py", line 613, in invoke
return callback(*args, **kwargs)
File "/src/dynaconf/dynaconf/cli.py", line 476, in get
result = settings[key] # let the keyerror raises
File "/src/dynaconf/dynaconf/utils/functional.py", line 19, in inner
return func(self._wrapped, *args)
File "/src/dynaconf/dynaconf/base.py", line 315, in __getitem__
raise KeyError(f"{item} does not exist")
KeyError: 'DONTEXIST does not exist'Expected behavior
$ dynaconf get DONTEXIST
Key not found. # stderr
$ echo $? # proper retcode
1The same behavior as we have in list
$ dynaconf list -k DONTEXIST
Django app detected
Working in development environment
Key not foundReactions are currently unavailable