001/* 002 * (C) Copyright 2006-2011 Nuxeo SA (http://nuxeo.com/) and others. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 * 016 * Contributors: 017 * Thierry Delprat 018 */ 019package org.nuxeo.ecm.core.api; 020 021/** 022 * Exception that can be handled at UI level to display a dedicated user message 023 * 024 * @since 5.6 025 */ 026public class RecoverableClientException extends NuxeoException { 027 028 private static final long serialVersionUID = 1L; 029 030 protected final String localizedMessage; 031 032 protected final String[] params; 033 034 public enum Severity { 035 WARN, ERROR, FATAL 036 }; 037 038 protected Severity severity = Severity.ERROR; 039 040 public RecoverableClientException(String message, String localizedMessage, String[] params) { 041 super(message); 042 this.localizedMessage = localizedMessage; 043 this.params = params; 044 } 045 046 public RecoverableClientException(String message, String localizedMessage, String[] params, Throwable cause) { 047 super(message, cause); 048 this.localizedMessage = localizedMessage; 049 this.params = params; 050 } 051 052 @Override 053 public String getLocalizedMessage() { 054 return localizedMessage; 055 } 056 057 public String[] geLocalizedMessageParams() { 058 return params; 059 } 060 061 public Severity getSeverity() { 062 return severity; 063 } 064 065 public void setSeverity(Severity severity) { 066 this.severity = severity; 067 } 068}