org.omnifaces.util.Exceptions Java Examples
The following examples show how to use
org.omnifaces.util.Exceptions.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CustomExceptionHandlerWrapper.java From library with Apache License 2.0 | 6 votes |
/** * Method to handle the generic exception and take a decision of witch step to take after identify the type of the * exception * * All non mapped exceptions on the {@link #customExceptionHandlers} will treated as generic exceptions on the * {@link UndefinedExceptionHandler} */ @SuppressWarnings("unchecked") private void handleException() { final Iterator<ExceptionQueuedEvent> unhandled = getUnhandledExceptionQueuedEvents().iterator(); if (unhandled.hasNext()) { final Throwable throwable = unhandled.next() .getContext() .getException(); unhandled.remove(); final FacesContext context = FacesContext.getCurrentInstance(); final Throwable rootCause = Exceptions.unwrap(throwable); this.customExceptionHandlers.stream() .filter(handler -> handler.accept(rootCause)) .findFirst() .ifPresentOrElse(handler -> handler.handle(context, rootCause), () -> this.undefinedExceptionHandler.handle(context, rootCause)); } }
Example #2
Source File: CustomExceptionHandler.java From admin-template with MIT License | 6 votes |
/** * @param context * @throws Throwable */ private void handleException(FacesContext context) { Iterator<ExceptionQueuedEvent> unhandledExceptionQueuedEvents = getUnhandledExceptionQueuedEvents().iterator(); if (unhandledExceptionQueuedEvents.hasNext()) { Throwable exception = unhandledExceptionQueuedEvents.next().getContext().getException(); unhandledExceptionQueuedEvents.remove(); Throwable rootCause = Exceptions.unwrap(exception); if (rootCause instanceof BusinessException) { handleBusinessException(context, (BusinessException) rootCause); return; } //send user to error page when unexpected exceptions are raised goToErrorPage(context, rootCause); } }
Example #3
Source File: CustomExceptionHandlerWrapper.java From web-budget with GNU General Public License v3.0 | 6 votes |
/** * Method to handle the generic exception and take a decision of witch step to take after identify the type of the * exception * * All non mapped exceptions on the {@link #customExceptionHandlers} will treated as generic exceptions on the * {@link UndefinedExceptionHandler} */ @SuppressWarnings("unchecked") private void handleException() { final Iterator<ExceptionQueuedEvent> unhandled = getUnhandledExceptionQueuedEvents().iterator(); if (unhandled.hasNext()) { final Throwable throwable = unhandled.next() .getContext() .getException(); unhandled.remove(); final FacesContext context = FacesContext.getCurrentInstance(); final Throwable rootCause = Exceptions.unwrap(throwable); this.customExceptionHandlers.stream() .filter(handler -> handler.accept(rootCause)) .findFirst() .ifPresentOrElse(handler -> handler.handle(context, rootCause), () -> this.undefinedExceptionHandler.handle(context, rootCause)); } }
Example #4
Source File: CustomExceptionHandlerWrapper.java From web-budget with GNU General Public License v3.0 | 6 votes |
/** * Method to handle the generic exception and take a decision of witch step to take after identify the type of the * exception * * All non mapped exceptions on the {@link #customExceptionHandlers} will treated as generic exceptions on the * {@link UndefinedExceptionHandler} */ @SuppressWarnings("unchecked") private void handleException() { final Iterator<ExceptionQueuedEvent> unhandled = getUnhandledExceptionQueuedEvents().iterator(); if (unhandled.hasNext()) { final Throwable throwable = unhandled.next() .getContext() .getException(); unhandled.remove(); final FacesContext context = FacesContext.getCurrentInstance(); final Throwable rootCause = Exceptions.unwrap(throwable); this.customExceptionHandlers.stream() .filter(handler -> handler.accept(rootCause)) .findFirst() .ifPresentOrElse(handler -> handler.handle(context, rootCause), () -> this.undefinedExceptionHandler.handle(context, rootCause)); } }
Example #5
Source File: BusinessLogicExceptionHandler.java From library with Apache License 2.0 | 2 votes |
/** * {@inheritDoc} * * @param throwable * @return */ @Override public boolean accept(Throwable throwable) { return Exceptions.is(throwable, BusinessLogicException.class); }
Example #6
Source File: ConstraintViolationExceptionHandler.java From library with Apache License 2.0 | 2 votes |
/** * {@inheritDoc} * * @param throwable * @return */ @Override public boolean accept(Throwable throwable) { return Exceptions.is(throwable, ConstraintViolationException.class); }
Example #7
Source File: BusinessLogicExceptionHandler.java From web-budget with GNU General Public License v3.0 | 2 votes |
/** * {@inheritDoc} * * @param throwable * @return */ @Override public boolean accept(Throwable throwable) { return Exceptions.is(throwable, BusinessLogicException.class); }
Example #8
Source File: ConstraintViolationExceptionHandler.java From web-budget with GNU General Public License v3.0 | 2 votes |
/** * {@inheritDoc} * * @param throwable * @return */ @Override public boolean accept(Throwable throwable) { return Exceptions.is(throwable, ConstraintViolationException.class); }
Example #9
Source File: BusinessLogicExceptionHandler.java From web-budget with GNU General Public License v3.0 | 2 votes |
/** * {@inheritDoc} * * @param throwable * @return */ @Override public boolean accept(Throwable throwable) { return Exceptions.is(throwable, BusinessLogicException.class); }
Example #10
Source File: ConstraintViolationExceptionHandler.java From web-budget with GNU General Public License v3.0 | 2 votes |
/** * {@inheritDoc} * * @param throwable * @return */ @Override public boolean accept(Throwable throwable) { return Exceptions.is(throwable, ConstraintViolationException.class); }