error-handling
Asyncio: Weirdness of Task exception was never retrieved
A Exception in the Task (of underlying asyncio.Future to be precise) can be retrieved with Future.exception(). If it’s not retrieved, the exception will be handled at release of the Future object with eventloop’s call_exception_handler. So, as @dirn pointed, while the Task has reference (assigned to variable in your case) it’s not going be freed, therefore … Read more
NLog rotate and cleanup logfiles
It looks like the problem is the shortdate in your filename definition. See my answer at this question: Delete log files after x days You have to define the filename without the date part fileName=”${basedir}/logs/Log.info.txt
Best practices for defining your own exception classes?
Yes, it’s good practice to inherit from std::runtime_error or the other standard exception classes like std::logic_error, std::invalid_argument and so on, depending on which kind of exception it is. If all the exceptions inherit some way from std::exception it’s easy to catch all common errors by a catch(const std::exception &e) {…}. If you have several independent … Read more
jQuery AJAX Error Handling (HTTP Status Codes)
Check out jQuery.ajaxError() It catches global Ajax errors which you can handle in any number of ways: if (jqXHR.status == 500) { // Server side error } else if (jqXHR.status == 404) { // Not found } else if { … Alternatively, you can create a global error handler object yourself and choose whether to … Read more
How do I catch node.js/express server errors like EADDRINUSE?
The accepted solution did not work for me on nodejs 0.8.22 and express 3.1.0. This did the trick: process.on(‘uncaughtException’, function(err) { if(err.errno === ‘EADDRINUSE’) console.log(…); else console.log(err); process.exit(1); }); Also see Node.js Express app handle startup errors
How to report errors in a procedural macro using the quote macro?
Apart from panicking, there are currently two ways to reports errors from a proc-macro: the unstable Diagnostic API and “the compile_error! trick”. Currently, the latter is mostly used because it works on stable. Let’s see how they both work. The compile_error! trick Since Rust 1.20, the compile_error! macro exists in the standard library. It takes … Read more
Rails: How do I create a custom 404 error page that uses the asset pipeline?
For Rails 4.1 I like this answer, add an asset type better; however I have not tried it. On Rails 4.0.8, these three references helped me: Dynamic error pages is the second reference in the question. This worked just fine for me. Custom error pages may have cribbed from the first reference, or the other … Read more
Should I avoid unwrap in production application?
While the whole “error handling”-topic is very complicated and often opinion based, this question can actually be answered here, because Rust has rather narrow philosophy. That is: panic! for programming errors (“bugs”) proper error propagation and handling with Result<T, E> and Option<T> for expected and recoverable errors One can think of unwrap() as converting between … Read more
Can I throw an error in vbscript?
While @helen’s answer is correct it is a bit sparse. It details the Err.Raise() method but misses out some key points. From the original question However, is there some way I can generate my own errors? For example if one of my functions is passed the wrong type of parameter I’d rather my script just … Read more