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

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

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

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)