working on Java error handling code from the Prolog side