Login  Register

Re: exception using QL_Fail/QL_Require

Posted by Peter Caspers-4 on Dec 14, 2016; 3:47pm
URL: http://quantlib.414.s1.nabble.com/exception-using-QL-Fail-QL-Require-tp17920p17921.html

Hi Hans,

QL_FAIL and QL_REQUIRE and the like throw an QuantLib::Error which extends std::exception. So what you see is perfectly expected, it is just the result from an uncaught exception. To see the error message you have to catch the exception and output it’s what()-result to std::clog or the like.

Kind Regards
Peter

On 14 Dec 2016, at 10:59, 杨 斯涵 <[hidden email]> wrote:

Dear all, 

i have started a new project which depends on Quantlib and i have successfully built it (in fact i currently only use QL error macros, i.e QL_FAIL)

However whenever the compiler goes to QL_FAIL line,  it gives  exception message and stopped working:

First-chance exception at 0x7503b727 in project.exe: Microsoft C++ exception: QuantLib::Error at memory location 0x0041f424..
Unhandled exception at 0x771f15ee in project.exe: Microsoft C++ exception: QuantLib::Error at memory location 0x0041f424.

my code is very simple and i use QL_FAIL like:

if(!file.is_open())
{
     QL_FAIL(" the file does not exist");
}

I tried QL_Require it gives same error.

I see ERROR macro works fine in Quantlib but cant figure out what goes wrong in my project. Could someone pls give kindly some advise?

Thanks in advance,
Hans

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users