Replies: 1 comment 3 replies
-
|
I think raising an error when And it would be laughably easy for me to do from the ARMI side. The QUESTION I have is: what percentage of downstream applications would immediately fail when I made this change? Now, for internal TP code, we could run such a test and find out. For external projects, it would be far less direct. But for me this change is more about taking time to do the due diligence to make sure there aren't 1,000 workflows that will immediately fail when making this change. That's all. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
We have some patterns internally and downstream that look like
but with different exceptions, more useful message, etc. etc. But we like to have a
runLog.errorwith a message so it goes in stdout, and then the exception is thrown.There are some cases where someone may want to log an error but not trash the run. Maybe not at that spot, maybe not at all. But that gets more into a philosphy discussion: does an error always mean you want to crash out?
I propose instead to skip that and just add something like
runLog.exception(msg, excType=RuntimeError)that wouldrunLog.error(msg), and thenraise excType(msg). Probably always want this to be aRuntimeErrorbut maybe you want to provide some more context in the exception.Alternatively, if you caught some error and want to provide some more context, you may have a pattern like
then you still have the traceback from the thing that caused the real error, but with some higher-level context.
This might look like
runLog.exception(msg, RuntimeError, ee)where you pass in the caught exception likeThings to consider
The downside of putting the literal
raisecommand one level away is the traceback is going to terminate in therunLog.exceptioncall. Not the actual location you'd want to point a developer or user at. That's not ideal but I think there are some stack manipulations we could do to avoid thatBeta Was this translation helpful? Give feedback.
All reactions