Discussions related to Visual Prolog
User avatar
George
Active Member
Posts: 47
Joined: 19 Sep 2011 8:54

How can we define a user defined exception for the error code ?

Unread post by George »

I see that, errorExit(1000) is used to raise the exception -

What does the Error code(1000) means ?

How can I get the error message ?

Is there any way user can define our own exception to the error code ?

Code: Select all

class predicates     testException : (integer ) . clauses     testException(Var):-         try             if Var <> 1 then                 succeed()             else                 errorExit(1000)  %throw to catch block - How to define a user message to the error code?             end if         catch TraceID do             vpiCommonDialogs::note(exceptionDump::dumpToString(TraceID))         end try,         !.
Please advice me about define a user defined exception..I'd like to give a meaningful error message for some scenario.

Thanks in advance..
Kind Regards,
George Ananth. S | Prolog Developer
georgeananth.prolog@gmail.com
+91 9791499282
User avatar
George
Active Member
Posts: 47
Joined: 19 Sep 2011 8:54

Unread post by George »

I think, we can do it in the following way,

Code: Select all

class predicates     testException : (integer ) . clauses     testException(Var):-         try             if Var <> 1 then                 succeed()             else                 exception::raise_user("App Error")             end if         catch TraceID do             vpiCommonDialogs::note(exceptionDump::dumpToString(TraceID))         end try,         !.
Kind Regards,
George Ananth. S | Prolog Developer
georgeananth.prolog@gmail.com
+91 9791499282
User avatar
Thomas Linder Puls
VIP Member
Posts: 1398
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls »

Also have a look at: Exception Handling
Regards Thomas Linder Puls
PDC
Post Reply