001/* 002 * Copyright (c) 2006-2011 Nuxeo SA (http://nuxeo.com/) and others. 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the Eclipse Public License v1.0 006 * which accompanies this distribution, and is available at 007 * http://www.eclipse.org/legal/epl-v10.html 008 * 009 * Contributors: 010 * Thierry Delprat 011 */ 012package org.nuxeo.ecm.core.api; 013 014/** 015 * Exception that can be handled at UI level to display a dedicated user message 016 * 017 * @since 5.6 018 */ 019public class RecoverableClientException extends NuxeoException { 020 021 private static final long serialVersionUID = 1L; 022 023 protected final String localizedMessage; 024 025 protected final String[] params; 026 027 public enum Severity { 028 WARN, ERROR, FATAL 029 }; 030 031 protected Severity severity = Severity.ERROR; 032 033 public RecoverableClientException(String message, String localizedMessage, String[] params) { 034 super(message); 035 this.localizedMessage = localizedMessage; 036 this.params = params; 037 } 038 039 public RecoverableClientException(String message, String localizedMessage, String[] params, Throwable cause) { 040 super(message, cause); 041 this.localizedMessage = localizedMessage; 042 this.params = params; 043 } 044 045 @Override 046 public String getLocalizedMessage() { 047 return localizedMessage; 048 } 049 050 public String[] geLocalizedMessageParams() { 051 return params; 052 } 053 054 public Severity getSeverity() { 055 return severity; 056 } 057 058 public void setSeverity(Severity severity) { 059 this.severity = severity; 060 } 061}