Files
scryer-prolog/src
J.J. Tolton 617a551a56 Add g_caused_exception/2 for custom toplevel error handling
When a goal throws an exception during initialization (-g flag), the
system now asserts g_caused_exception(Goal, Exception) in the user
module. This allows custom toplevels (-t flag) to check if an error
occurred and handle it appropriately.

Example usage:
  scryer-prolog -g "throw(error)" -t check_error

Where check_error can be:
  :- dynamic(g_caused_exception/2).

  check_error :-
      (   g_caused_exception(_, E) ->
          write('Error: '), write(E), nl, halt(1)
      ;   halt(0)
      ).

This enables scripts to use custom toplevels for sophisticated error
handling and exit code logic.

Addresses: https://github.com/mthom/scryer-prolog/pull/3147#issuecomment-3503875719

Co-Authored-By: J.J.'s Robot <jjtolton@gmail.com>
2025-11-09 12:44:48 -05:00
..
2025-02-20 01:04:38 -03:00
2025-09-28 19:50:21 +02:00
2025-09-27 22:48:05 +02:00
2025-07-07 22:38:10 -07:00
2025-08-18 20:52:15 +02:00
2025-08-23 14:34:49 -07:00
2024-07-23 00:01:58 +02:00
2025-08-23 14:34:49 -07:00
2025-07-07 22:38:12 -07:00
2025-08-25 20:47:29 +02:00
2025-07-07 22:38:10 -07:00
2025-07-07 22:38:10 -07:00
2025-04-10 19:02:04 +02:00