exception-handling

Returning From Catching A Floating Point Exception

 ̄綄美尐妖づ 提交于 2021-02-07 14:37:39
问题 So, I am trying to return from a floating point exception, but my code keeps looping instead. I can actually exit the process, but what I want to do is return and redo the calculation that causes the floating point error. The reason the FPE occurs is because I have a random number generator that generates coefficients for a polynomial. Using some LAPACK functions, I solve for the roots and do some other things. Somewhere in this math intensive chain, a floating point exception occurs. When

Returning From Catching A Floating Point Exception

不问归期 提交于 2021-02-07 14:36:13
问题 So, I am trying to return from a floating point exception, but my code keeps looping instead. I can actually exit the process, but what I want to do is return and redo the calculation that causes the floating point error. The reason the FPE occurs is because I have a random number generator that generates coefficients for a polynomial. Using some LAPACK functions, I solve for the roots and do some other things. Somewhere in this math intensive chain, a floating point exception occurs. When

Returning From Catching A Floating Point Exception

北慕城南 提交于 2021-02-07 14:35:28
问题 So, I am trying to return from a floating point exception, but my code keeps looping instead. I can actually exit the process, but what I want to do is return and redo the calculation that causes the floating point error. The reason the FPE occurs is because I have a random number generator that generates coefficients for a polynomial. Using some LAPACK functions, I solve for the roots and do some other things. Somewhere in this math intensive chain, a floating point exception occurs. When

What approach is there for handling and returning errors (non-exceptional and exceptional) in Domain Driven Design entities and aggregate roots?

我怕爱的太早我们不能终老 提交于 2021-02-07 11:48:20
问题 I'm trying to find a good article/examples of how DDD entities treat errors (and what would be considered exceptional errors and what wouldn't) and how they pass them up to the calling application layer (which usually wraps operations in a transaction that would need to be rolled back). Currently I'm thinking to consider all errors that would break the transaction of an aggregate (such as validation) to be exceptions. This way I can rollback the transaction in a "catch" block. For example:

Handle exception and continue executing

孤街醉人 提交于 2021-02-07 09:28:30
问题 [EDIT - Disclaimer: This is a really bad idea, see the accepted answer for an actual solution.] I define my own exception handler using set_exception_handler() function. After the handler execution, I need the script to continue. Is there any way to do it? Disclaimer: I know try-catch blocks but I need to process Exceptions dynamicaly. Every calling of Clazz::foo() specifies its own exceptions which should be caught by my handler. That's the reason I can't use it. Example: class Clazz {

Exceptions thrown in asynchronous javascript not caught

孤街醉人 提交于 2021-02-07 05:39:21
问题 Basically, why isn't this exception caught? var http = require('http'), options = { host: 'www.crash-boom-bang-please.com', port: 80, method: 'GET' }; try { var req = http.request(options, function(res) { res.setEncoding('utf8'); res.on('data', function (chunk) { console.log('BODY: ' + chunk); }); }); req.on('error', function(e) { throw new Error("Oh noes"); }); req.end(); } catch(_error) { console.log("Caught the error"); } Some people suggest that these errors need to be handled with event

Problems with recursive generic type in c#

这一生的挚爱 提交于 2021-02-06 15:24:10
问题 I've got some C# code that compiles fine under both mono and the Microsoft's .net compilers, but only runs on mono. The error message is (newlines added by me) Unhandled Exception: System.TypeLoadException: Could not load type 'Hasse.Groups.Heavy.Product.PowerGroup`1' from assembly 'Hasse, Version=1.0.x.y, Culture=neutral, PublicKeyToken=null' because it has recursive generic definition. The type actually has a recursive generic definition, so my question is: why does it work with mono? [The

Problems with recursive generic type in c#

纵饮孤独 提交于 2021-02-06 15:21:10
问题 I've got some C# code that compiles fine under both mono and the Microsoft's .net compilers, but only runs on mono. The error message is (newlines added by me) Unhandled Exception: System.TypeLoadException: Could not load type 'Hasse.Groups.Heavy.Product.PowerGroup`1' from assembly 'Hasse, Version=1.0.x.y, Culture=neutral, PublicKeyToken=null' because it has recursive generic definition. The type actually has a recursive generic definition, so my question is: why does it work with mono? [The

Reusing exception handling code in C++

眉间皱痕 提交于 2021-02-06 15:15:38
问题 I have these two functions, with duplicated exception treatment, which has the sole purpose of displaying an error message: void func1() noexcept { try { do_task(); do_another_task(); } catch (const std::out_of_range& e) { show_msg("Out of range error", e.what()); } catch (const std::logic_error& e) { show_msg("Logic error", e.what()); } catch (const std::system_error& e) { show_msg("System error", e.what()); } catch (const std::runtime_error& e) { show_msg("Runtime error", e.what()); } catch

Reusing exception handling code in C++

流过昼夜 提交于 2021-02-06 15:14:28
问题 I have these two functions, with duplicated exception treatment, which has the sole purpose of displaying an error message: void func1() noexcept { try { do_task(); do_another_task(); } catch (const std::out_of_range& e) { show_msg("Out of range error", e.what()); } catch (const std::logic_error& e) { show_msg("Logic error", e.what()); } catch (const std::system_error& e) { show_msg("System error", e.what()); } catch (const std::runtime_error& e) { show_msg("Runtime error", e.what()); } catch