nixops script: Remove top-level Exception catch-all. #924
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Below is a small patch to fix one of my biggest gripes in using and developing nixops, and in helping colleagues and friends fix their problems.
Having this catch-all made it difficult to develop and troubleshoot
nixops.
For example, when adding a new backend and forgetting to add the
corresponding
option
in the.nix
file, nixops would die simplywith
which is not a good indication over what went wrong.
Specifically so because
error(str(e))
removed the type of theexception, turning
KeyError: 'serverType'
into justserverType
.So far, you could pass
--show-trace
or--debug
to seePython stack traces.
However, that requires the error to be easily reproducible
(when you see it, you have to run again with
--show-trace
),making debugging of rare problems hard.
For an ops tool we should make debugging of rare/unknown
problems as easy as possible.
Consequently, this commit makes Python raise the
Exception
with stack trace if we have no idea at all what the exception
type is.
The other cases (when we know what exception type it is)
remain unaffected.