There are Prolog predicates that output error messages, like load_files/1 in case the file could not be found:
error(existence_error(source_sink,'/home/foo/nothinghere.txt'),_3724).
These error messages are just printed to stdout but are not returned as prolog return value.
In my case, load_files/1 gets called deep down as part of a procedure that I don't want to modify. I just deliver the file name and wait for the return value. But as far as I understand, the return value, in this case, is either True or an error. Is there any way for me to redirect the error output to the return value so that I can actually do something with the output I am getting?