Re: Problem catching some errors

Torbjörn Lager <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <CA+Y3JZiY097s7ra1nRS+QKpCEx0eX+Tqx-nzV7DSJyKpBE_uUQ@mail.gmail.com>
Ok, that makes sense. I'll try to see what can be done with message hooks.

Best,
Torbjörn

On Sat, Aug 17, 2013 at 9:25 PM, Jan Wielemaker <[email protected]> wrote:
> 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
>>



-- 
Torbjörn Lager
Professor of General and Computational Linguistics
Department of Philosophy, Linguistics and Theory of Science
University of Gothenburg
Box 200, SE-405 30 Gothenburg, Sweden
Phone: +46317864962
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.