-
Notifications
You must be signed in to change notification settings - Fork 2
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
Standardize CRUD try catch logic #145
Comments
I think the question becomes: where are the exceptions caught and thrown? |
Personal preference is user is responsible for Type 1 errors, even if it is a code problem inside the Caesar framework. Reason: else any error in the code is never caught, its always just "the code fails softly and I dont know where its broken". However, if all the code is working right, but something physical is resulting in the error -- such as trying to communicating with a DB which is not active, then it makes sense to come back with a message that DB host not reachable -- which is better than an obscure code error. This is what I mean by Type 2 errors. But still log the full obscure error stack somewhere, but any try catch will obviously grab all type 1 errors inside as well. This was a real problem for me a couple of months ago, when trying to debug through layers of try catch statements -- makes it really difficult. I think Type 2 try catch only works once we know all Type 1 errors below have already been found and resolved. Hence my general avoidance of wrapping try catch statements in the middle somewhere. Think @GearsAD may feel different on this ( and he has the experience ). We had not resolved this decision in the past before. At minimum we should decide on:
|
try catch as low down as possible for known Type 2 errors seems like a viable way to go? |
Ok, I tend to agree with you. However I would say it is only applicable to new errors thrown and should not be wrapped in try catch at all. |
Should we split Type 2 errors further, as either:
|
Scenario:
Suggestion is reason why failed should be in general DFG Caesar code, other errors occur outside dfg. |
From an user perspective:
From an automated system perspective:
|
I see some of the packages are starting to use specialized exception types for more informative failures -- we are not alone :-) |
Comment mistake, taking this over from #182 Sam said (FROM SLACK):
Personally i prefer hard errors over silent failures. I'm scared returning nothing will create more confusion. Know we spoke about this at length in the past. I vote it should error and user can deal with it in a try catch statement. I personally don't think we should follow a pattern where try catches get built way down (unless they have really useful error messages). But that is the same as throwing a typed exception. The Julia auto generated errors, like :x1 does not exist in labelDict is pretty good already. Punchline, I vote go with allowing errors to propagation up for standard CRUD. |
Converging towards decision that graph CRUD should propagate errors and not |
In time we can add Typed Exceptions as resources allow, but not presume ::Nothing when something didn't work in the "early days". |
As long as these hold
|
Sam liked Exceptions over nothing (Slack). Done, thanks. |
Personally I believe that errors and typed exceptions should work in Julia, and that we should fail early. I'm hoping this is possible. If we return nothing in some cases but not all, then functions that make use of inner functions will have strange behavior. Consider So the code become complex very quickly. Rather - my opinion - fail early and let the user know asap. If we can't, that's ok, but let's try keep things simple if at all possible. |
Error handling inside a CRUD function could be divided into two categories (do or dont do try catch inside CRUD) -- also see similar Midori model here:
Repeat example from #134
Only do try catch on CRUD Type 2 errors?
Example DB, bad comms, etc. Similar discussion for internal retries. Type 2 errors would then also return
@assert
!flag if internal try catch or retries expired.The text was updated successfully, but these errors were encountered: