Re: Problem catching some errors
Jan Wielemaker <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <[email protected]> |
On 08/17/2013 08:52 PM, Torbjörn Lager wrote:
> Hi,
>
> I notice that catch/3 doesn't catch permission errors calling
> predicates such as use_module/1 and load_files/2. Eg:
>
> ?- catch(use_module('apps/test_2'), E, true).
> ERROR: /Users/lager/Development/swish/apps/test_2.pl:3:
> No permission to modify static procedure `read/2'
>
> Is there a particular reason for that? Or is it a bug?
Yes. If exceptions in directives or compilation would throw
the exception up to the caller of load_files, compilation would
stop at the first error. The only exceptions that is passed to
load_files are exceptions that result from opening the file.
If you want to act on compiler warnings you can use message
hooks.
Cheers --- Jan
>
> Best,
> Torbjörn
>