001/*
002 * Copyright (c) 2006-2015 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 *     Bogdan Stefanescu
011 *     Florent Guillaume
012 */
013package org.nuxeo.ecm.core.api;
014
015/**
016 * Deprecated and never thrown, kept for compatibility.
017 * <p>
018 * Use {@link org.nuxeo.ecm.core.api.NuxeoException} instead.
019 *
020 * @deprecated since 7.4, use org.nuxeo.ecm.core.api.NuxeoException instead
021 */
022@Deprecated
023public class ClientException extends NuxeoException {
024
025    private static final long serialVersionUID = 1L;
026
027    public ClientException() {
028    }
029
030    public ClientException(String message) {
031        super(message);
032    }
033
034    public ClientException(String message, Throwable cause) {
035        super(message, cause);
036    }
037
038    public ClientException(Throwable cause) {
039        super(cause);
040    }
041
042    public static ClientException wrap(Throwable exception) {
043        ClientException clientException;
044        if (null == exception) {
045            clientException = new ClientException("Root exception was null. Please check your code.");
046        } else {
047            if (exception instanceof ClientException) {
048                clientException = (ClientException) exception;
049            } else {
050                clientException = new ClientException(exception.getLocalizedMessage(), exception);
051            }
052        }
053        return clientException;
054    }
055
056}