/** * Gets the decoration for an entity, and returns an "error" decoration in case of problem. */ protected <T> List<? extends Decoration> getDecorations(ProjectEntity entity, Decorator<T> decorator) { try { return decorator.getDecorations(entity); } catch (Exception ex) { return Collections.singletonList( Decoration.error(decorator, getErrorMessage(ex)) ); } }