Extracting information from PL_exception()
Kaitain Jones <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <CAMeycMy9wOSHAGb9QXc3-HBWW-QAHXRXcZKT9jyYgxBLhdLk9A@mail.gmail.com> |
I'm trying to work out what information I'm able to extract from calling PL_exception() from C after a call to PL_next_solution() has failed. I've set up a test case in which the underlying PL predicate will hit a guaranteed error due to it referencing another predicate that has not in fact been defined. So PL_next_solution() fails, as expected, and PL_exception() succeeds and returns a term_t term value. But what exactly is the value so returned (or, rather, the structure to which it is a handle)? I've ascertained that it is of type PL_TERM. (This is using the latest SWI on Windows, btw.) But it isn't a list or a string, and the most info I've been able to extract is by calling PL_get_name_arity(...), which tells me that it has name "error" and is of arity 2. But...is that it? In my simple console app the corresponding call sends the exception to the console: ERROR: test_predicate/1: Undefined procedure: nonsense_predicate/1 Exception: (6) nonsense_predicate(test_object) ? Trying to integrate into our full-blown windows app, I don't get this kind of error message for free. I was hoping that the exception might give it to me, but I can't tell from the documentation whether I should expect to have access to this message, and if so how to extract it. Any pointers would be appreciated. KJ -------------- next part -------------- HTML attachment scrubbed and removed