/** * Returns the non-<tt>null</tt> message of the first {@link #add(ExceptionRecognizer) add}ed * {@link ExceptionRecognizer service} that recognizes the exception. */ @Programmatic public final String recognize(final Throwable ex) { for (final ExceptionRecognizer ers : exceptionRecognizers) { final String message = ers.recognize(ex); if(message != null) { return message; } } return null; }
/** * Simply invokes {@link org.apache.isis.applib.services.exceprecog.ExceptionRecognizer#recognize(Throwable)} for all registered {@link org.apache.isis.applib.services.exceprecog.ExceptionRecognizer}s for the provided exception, so that the message will be translated. */ private void recognize(final Throwable ex) { final List<ExceptionRecognizer> exceptionRecognizers = getIsisSessionFactory().getServicesInjector().lookupServices(ExceptionRecognizer.class); for (final ExceptionRecognizer exceptionRecognizer : exceptionRecognizers) { final String unused = exceptionRecognizer.recognize(ex); } }