-
Notifications
You must be signed in to change notification settings - Fork 313
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
Stop hiding critical debug info in helpers (#988) #997
Stop hiding critical debug info in helpers (#988) #997
Conversation
4df0a08
to
fef7870
Compare
I am not able to see why the build is failing here but |
build fixed with PR #998 |
97af6ac
to
391fbc3
Compare
I'm not sure doing this across the board is better than the existing functionality. For example when i run scpeptre (ver 2.4.0) with an invalid profile i get this..
when i run with this change I get this.. invalid profile console out
Would it make sense to pinpoint the problem you were having in issue #988 first then determine a fix that's more targeted? Also would you not get more debug info if you simply pass in the sceptre |
We do use I think users should not lose development time just to make output look prettier when an exception is raised. If pretty output is required, I personally think the specific exception where pretty output is required should be handled. |
If --debug is not displaying the exception, maybe that's the change that should be made? |
@craighurley Yes true. Would you like me to refactor and only show the stack trace in debug mode? |
I agree with making |
Hi @alexharv074 , I think refactoring to only show the strace in debug would be great, but we should consider addressing the root cause as @zaro0508 mentioned. |
@craighurley Could you clarify what you mean by fixing the "root cause"? The root cause was that I did not have permission to read from an S3 bucket. |
Hi @alexharv074 , for the root cause what I meant was that if the error you were getting in #988 was not helpful, could it be caught with better matching and print something more useful for you (without Lines 262 to 269 in 881c6bd
That plus adding the stack trace as you described once What do you think? |
Also relates to #897 |
Hi @craighurley I agree with all your comments above. However, perhaps handling the specific exception that led me to this PR in the first place is something that belongs in a separate PR, perhaps even the one you linked just above? I say that because realistically I have forgotten how to reproduce the original issue and I am never going to find time to reproduce it. Whereas, simply refactoring this PR to only hide stack traces when mode != debug is something we can and should get merged quickly. Thoughts? |
I agree. |
I agree more useful debugging and errors is definitely something the project needs (I think there are plenty of open issues about this). The main issue with this change is that users may well (and probably) do rely on status exit codes on the CLI. Removing the status code and replacing it with a dump of the stack trace isn't going to be a good solution. Instead - better debug logging statements will help imo. |
@craighurley I have a bit of time this weekend, but |
944596c
to
93a15e8
Compare
Before this, the catch_exceptions function in cli/helpers would catch a range of exceptions and then hide all but the error message from the caller. Over the years, this has caused myself and others quite a lot of lost time, as it is now often quite unclear what caused Sceptre to fail. Simply re-raising the original exception provides valuable information to allow users of Sceptre to debug their failing code.
93a15e8
to
d0b8e7d
Compare
@craighurley how is this version? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think logging the exception might be a better approach... but I don't care too much either way.
Here are some before and after examples I have collected just in the last few days to illustrate why I am keen to get this merged: Example 1Before
To the caller, it is really not obvious what After
Now the caller knows:
Example 2Before
After
Ok, I can now see this is a bug or not implemented feature in Sceptre. Example 3Before
After
|
Before this, the
catch_exceptions
(decorator) function would catch arange of exceptions and then hide all but the error message from the
caller.
Over the years, this has caused some of us a lot of lost time, as it is
consequently not always clear what actually caused Sceptre to fail.
Simply re-raising the original exception provides valuable information
to allow users of Sceptre to debug their failing code.
This changes the function to re-raise in debug mode only.
PR Checklist
[Resolve #issue-number]
.make test
) are passing.make lint
) checks.and description in grammatically correct, complete sentences.
Approver/Reviewer Checklist
Other Information
Guide to writing a good commit