catch(:Goal,
+ExceptionType, ?Ball, :Recover)exception(ErrorType,Ball) is true. See error/2.
For example, the code below properly informs the user some file could
not be processed due do some issue with File, while
propagating on all other reasons while process/1
could not be executed.
catch(process(File), file_error, Ball,
file_not_processed(File, Ball))
file_not_processed(File, Ball) :-
message_to_string(Ball, Msg),
format(user_error, 'Could not process ~p: ~s', [File, Msg]).