- Aug 2023
-
stackoverflow.com stackoverflow.com
-
Active job instances include ActiveSupport::Rescuable which means you can use rescue_from in a job in the same way you can in a controller.
-
- Dec 2022
-
www.zhihu.com www.zhihu.com
-
如何评价王垠的《Kotlin和Checked Exception》?
Tags
Annotators
URL
-
-
www.zhihu.com www.zhihu.com
-
如何优雅的处理异常(java)?
Tags
Annotators
URL
-
- Nov 2022
-
github.com github.com
-
I just spent a day dismantling a model, trying to find the cause of the silent rollback - taking out every association, every validation, every callback, whittling down all the code in the transaction, only to finally discover that it was return true that was the cause of it all. Or yes, an exception!
-
- Sep 2022
-
metalblueberry.github.io metalblueberry.github.io
-
This code is much easier to understand as it do not add levels of indentation and follows the principle where the 0 indentation level is the principal path of the application where other paths are exceptions or rare cases.
-
-
www.postgresql.org www.postgresql.org
-
Otherwise behaves according to the value of null_value_treatment which must be one of 'raise_exception', 'use_json_null', 'delete_key', or 'return_target'. The default is 'use_json_null'.
-
- Apr 2022
-
stackoverflow.com stackoverflow.com
-
PHP try/catch and fatal error
-
-
www.learncpp.com www.learncpp.com
-
std::move_if_noexcept will return a movable r-value if the object has a noexcept move constructor, otherwise it will return a copyable l-value. We can use the noexcept specifier in conjunction with std::move_if_noexcept to use move semantics only when a strong exception guarantee exists (and use copy semantics otherwise).
如果在 move 过程中遇到异常,有什么办法可以处理?
-
- Jan 2022
-
github.com github.com
-
The best you can do is try/catch inside a function that is reactively called, but my goal is to have a global exception handler to handle all exceptions that I did not expect...
-
-
-
If at least one component has smallest unhandled error, the whole app will crash and users will not know what to do and developers will not know such an error occurred.
-
Boilerplate is only boilerplate if it's the same everywhere, which it shouldn't be.
-
-
-
thecodebarbarian.com thecodebarbarian.com
-
Some argue that throwing an exception in the executor function is bad practice. I strongly disagree.
-
- Sep 2021
-
thefamiliarstrange.com thefamiliarstrange.com
-
Masks and Their Moralities | The Familiar Strange. (n.d.). Retrieved September 1, 2021, from https://thefamiliarstrange.com/2021/08/30/masks-moralities/
-
- Jul 2021
-
stackoverflow.com stackoverflow.com
-
Throw it's a more elegant way to use an exception-like system as a control flow.
-
- Apr 2021
-
en.wikipedia.org en.wikipedia.org
-
The basic rule of thumb is: "I'm not aware of all types of security exploits. I must protect against those I do know of and then I must be proactive!".
-
- Mar 2021
-
www.nature.com www.nature.com
-
Savaris, R. F., G. Pumi, J. Dalzochio, and R. Kunst. ‘Stay-at-Home Policy Is a Case of Exception Fallacy: An Internet-Based Ecological Study’. Scientific Reports 11, no. 1 (5 March 2021): 5313. https://doi.org/10.1038/s41598-021-84092-1.
-
-
github.com github.compry/pry1
-
you can use the wtf? command to display a few lines of the backtrace for the most recent exception
-
- Feb 2021
-
trailblazer.to trailblazer.to
-
the ability to “error out” when something goes wrong
-
If anything here did fail in “validate omniauth”, all other steps in the chain would be skipped as the flow would follow the path leading to the failure terminus.
-
Things could go wrong in two places here. First, the validation could fail if Github sends us data we don’t understand. Second, we might not know the user signing in, meaning the “find user” logic has to error-out
-
-
sobolevn.me sobolevn.me
-
Literally, everything in this example can go wrong. Here’s an incomplete list of all possible errors that might occur: Your network might be down, so request won’t happen at all The server might be down The server might be too busy and you will face a timeout The server might require an authentication API endpoint might not exist The user might not exist You might not have enough permissions to view it The server might fail with an internal error while processing your request The server might return an invalid or corrupted response The server might return invalid json, so the parsing will fail And the list goes on and on! There are so maybe potential problems with these three lines of code, that it is easier to say that it only accidentally works. And normally it fails with the exception.
-
Return None. That’s evil too! You either will end up with if something is not None: on almost every line and global pollution of your logic by type-checking conditionals, or will suffer from TypeError every day. Not a pleasant choice.
-
we also wrap them in Failure to solve the second problem: spotting potential exceptions is hard
-
exceptions are not exceptional, they represent expectable problems
-
Exceptions are just like notorious goto statements that torn the fabric of our programs.
-
So, the sad conclusion is: all problems must be resolved individually depending on a specific usage context. There’s no silver bullet to resolve all ZeroDivisionErrors once and for all. And again, I am not even covering complex IO flows with retry policies and expotential timeouts.
Tags
- accidentally works
- the specific context is important
- too many ifs: bad
- programming: goto
- exceptions that are not exceptional
- traditional exception handling (try/catch; begin/rescue)
- analogy
- sad/unfortunate conclusion
- exceptions are expectable, not exceptional
- easy to miss / not notice (attention)
- error/exception handling: spotting potential exceptions is hard
- key point
- error/exception handling
- need to solve specific case/problems individually (there is no general solution)
- depends on use case / application
- anticipating what could go wrong / error/exception cases
- can't think of everything
- difficult/hard problem
Annotators
URL
-
-
-
certainly I wouldn't want it to start telling me that I'm not catching these!
-
-
www.morozov.is www.morozov.is
-
Railway Oriented Programming is a way to gracefully handle errors in your application
-
-
dry-rb.org dry-rb.org
-
Monads provide an elegant way of handling errors, exceptions and chaining functions so that the code is much more understandable and has all the error handling, without all the ifs and elses.
-
-
jrsinclair.com jrsinclair.com
-
-
As you can see, we end up with a lot of boilerplate if-statements. The code is more verbose. And it’s difficult to follow the main logic.
-
In JavaScript, we have a built-in language feature for dealing with exceptions. We wrap problematic code in a try…catch statement. This lets us write the ‘happy path’ in the try section, and then deal with any exceptions in the catch section. And this is not a bad thing. It allows us to focus on the task at hand, without having to think about every possible error that might occur.
-
And they are not the only way to handle errors.
-
In this article, we’ll take a look at using the ‘Either monad’ as an alternative to try...catch.
Tags
- error/exception handling
- verbose / noisy / too much boilerplate
- hard to follow/read/understand
- traditional exception handling (try/catch; begin/rescue)
- monad: Either
- JavaScript
- different way of solving/implementing something
- replacement for:
- sad path
- excellent technical writing
- elegant solution
- happy path
Annotators
URL
-
-
functionalprogramming.medium.com functionalprogramming.medium.com
-
en.wikipedia.org en.wikipedia.org
-
Maybe T can be understood as a "wrapping" type, wrapping the type T into a new type with built-in exception handling
-
Undefined values or operations are one particular problem that robust software should prepare for and handle gracefully.
-
-
blog.logrocket.com blog.logrocket.com
-
This style of error handling uses monadic behavior — a substitute way of handling errors.
-
-
stackoverflow.com stackoverflow.com
-
Personally, I prefer signalling an error for invalid values
-
-
-
You can rescue at the method level, but more likely you’d want to rescue at the statement level.
-
-
github.com github.com
-
Other filters will ignore blocks when given to them.
Would be better to raise an error if block isn't allowed/expected!
-
Note that it's perfectly fine to add errors during execution. Not all errors have to come from type checking or validation.
-
Inside the interaction, we could use #find instead of #find_by_id. That way we wouldn't need the #find_account! helper method in the controller because the error would bubble all the way up. However, you should try to avoid raising errors from interactions. If you do, you'll have to deal with raised exceptions as well as the validity of the outcome.
What they're referring to:
Account.find('invalid')
will raise an error butAccount.find_by(id: 'invalid')
will not.
-
- Nov 2020
-
stackoverflow.com stackoverflow.com
-
yell() { echo "$0: $*" >&2; } die() { yell "$*"; exit 111; } try() { "$@" || die "cannot $*"; }
-
- Jul 2020
-
code-examples.net code-examples.net
-
JSON parsing is always pain in ass. If the input is not as expected it throws an error and crashes what you are doing. You can use the following tiny function to safely parse your input. It always turns an object even if the input is not valid or is already an object which is better for most cases.
It would be nicer if the parse method provided an option to do it safely and always fall back to returning an object instead of raising exception if it couldn't parse the input.
-
- Jun 2020
-
-
Security agency frustration at the lack of lawful interception for encrypted messaging is understandable, but the problem with global over-the-top platforms is that once those weaknesses are inbuilt, they become potentially available to bad actors as well as good.
-
-
www.forbes.com www.forbes.com
-
They also argue that it cannot fall to them to determine good actors from bad—not all governments are forces for good, and who decides how each one should be treated.
-
- Apr 2020
-
github.com github.comrq/rq1
-
def handle_exception(self, job, *exc_info):
To unit test an exception handler:
worker = Worker(..., exception_handler=[handle_exception]) try: raise Exception() except Exception: exc_info = sys.exc_info() worker.handle_exception(job, *exc_info)
-
- Mar 2020
-
stackoverflow.com stackoverflow.com
-
To be just a bit polemic, your first instinct was not to do that. And you probably wouldn't think of that in your unit tests either (the holy grail of dynamic langs). So someday it would blow up at runtime, and THEN you'd add that safeguard.
-
I want to raise errors with more context
-
Exception#cause
-
As many would guess: ... catch StandardError => e raise $! ... raises the same error referenced by $!, the same as simply calling: ... catch StandardError => e raise ... but probably not for the reasons one might think. In this case, the call to raise is NOT just raising the object in $!...it raises the result of $!.exception(nil), which in this case happens to be $!.
-
-
ruby-doc.org ruby-doc.org
-
It is recommended that a library should have one subclass of StandardError or RuntimeError and have specific exception types inherit from it. This allows the user to rescue a generic exception type to catch all exceptions the library may raise even if future versions of the library add new exception subclasses.
-
-
www.honeybadger.io www.honeybadger.io
-
bugs.ruby-lang.org bugs.ruby-lang.org
-
-
matcher === exception or exception.cause && block[exception.cause]
-
-
stackoverflow.com stackoverflow.com
-
The pattern below has become exceptionally useful for me (pun intended). It's clean, can be easily modularized, and the errors are expressive. Within my class I define new errors that inherit from StandardError, and I raise them with messages (for example, the object associated with the error).
-
-
github.com github.com
- Mar 2019
-
www.thedevelopersconference.com.br www.thedevelopersconference.com.br
-
Você consegue visualizar a saúde da sua aplicação?
Ainda que aqui os tópicos da certificação não cubram exatamente esse assunto, monitorar a saúde de um sistema e suas aplicações é missão do profissional DevOps. Atente para os tópicos:
701 Software Engineering 701.1 Modern Software Development (weight: 6)
e
705.2 Log Management and Analysis (weight: 4)
-
- Jul 2017
-
-
Les analyses et courtes citations [3] justifiées par le caractère critique, polémique, pédagogique, scientifique ou d'information de l'oeuvre à laquelle elles sont incorporées
Tags
Annotators
URL
-
- Feb 2014
-
www.justinhughes.net www.justinhughes.net
-
The breakthrough patent that produces a Polaroid company is more the exception than the rule. The rule is the modestly successful novelist, the minor [*292] poet, and the university researcher -- all of whom may profit by licensing or selling their creations.
Breakthrough patent of Polaroid (the exception) vs modestly successful novelist (the more common case)
-