Commit 80cc71c4 authored by SOLIMAN Sylvain's avatar SOLIMAN Sylvain

use print_message for our own exceptions too

parent b74cc441
......@@ -58,27 +58,18 @@ execute_command(Command) :-
throw(error(prolog_failure))
),
Exception,
print_exception(Exception)
print_message(error, Exception)
).
print_exception(Exception) :-
(
Exception = error(Error),
error_message(Error, Message)
->
format('~w\n', Message)
;
format('Uncaught exception: ~p\n', Exception)
).
error_message(unknown_command(Command), Message) :-
format(atom(Message), 'Unknown command: ~p', [Command]).
prolog:message(error(unknown_command(Command))) -->
['Unknown command: ~p'-[Command]].
prolog:message(error(prolog_failure)) -->
['Prolog failure'].
error_message(prolog_failure, Message) :-
format(atom(Message), 'Prolog failure', []).
prolog:message(error(Exception)) -->
['Uncaught exception: ~p'-[Exception]].
check_types(Command, ArgumentTypes, NewCommand) :-
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment