diff options
Diffstat (limited to 'repl.pl')
-rw-r--r-- | repl.pl | 47 |
1 files changed, 47 insertions, 0 deletions
@@ -75,11 +75,58 @@ write_bindings([Var = Val|Bs]) :- ), write_bindings(Bs). +print_exception(error(E, _)) :- + write('Unhandled error: + '), % \n\t + print_error(E), + nl. print_exception(E) :- + E \= error(_,_), write('Unhandled exception: '), write(E), nl. +print_error(instantiation_error) :- + write('instantiation error'). +print_error(type_error(ValidType, Culprit)) :- + write('type error, expected '), + write(ValidType), + write(': '), + write(Culprit). +print_error(domain_error(ValidDomain, Culprit)) :- + write('domain error, expected '), + write(ValidDomain), + write(': '), + write(Culprit). +print_error(existence_error(ObjectType, Culprit)) :- + write('existence error, '), + write(Culprit), + write(' is not an existing object of type: '), + write(ObjectType). +print_error(permission_error(Operation, Type, Culprit)) :- + write('permission error, cannot '), + write(Operation), + write(' '), + write(Type), + write(': '), + write(Culprit). +print_error(representation_error(Flag)) :- + write('representation error: '), + write(Flag). +print_error(evaluation_error(Error)) :- + write('evaluation error: '), + write(Error). +print_error(resource_error(Res)) :- + write('resource error: '), + write(Res). +print_error(syntax_error(E)) :- + write('syntax error: '), + write(E). +print_error(system_error) :- + write('system error'). +print_error(E) :- + write(E). + whitespace(' '). whitespace(' '). whitespace(' |