% Demonstrates new features of Prova 1.8 and above
% - the "raise" built-in predicate for throwing exceptions.

:- eval(raise_test()).

handle_exceptions(Msg) :-
	exception(Ex),
	print([Ex]),
	println([Msg]),
	fail().

raise_test() :-
	on_exception(java.lang.Exception,handle_exceptions(" in raise_test()")),
	Ex = java.lang.Exception("A Prova exception"),
	raise(Ex).
