/******************************************************************************* * Copyright (c) 2013, Perforce Software * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ package com.perforce.p4java.extension.exception; import com.perforce.p4java.exception.RequestException; import com.perforce.p4java.extension.utility.ErrorId; /** * Exceptions when the Perforce server encounters an error during its processing * of the request */ public class ServerErrorException extends ServerException { private static final long serialVersionUID = 6970022851914177600L; private int severity = -1; private String code; public ServerErrorException(String message, Throwable cause) { super(message, cause); } public ServerErrorException(String message) { super(message); } public ServerErrorException(RequestException e) { super(e.getMessage(), e); this.severity = e.getSeverityCode(); this.code = String.valueOf(e.getRawCode()); } public ServerErrorException(Throwable cause) { super(cause); } public ServerErrorException(ErrorId error) { super(error.getFormat()); severity = error.getSeverity(); code = String.valueOf(error.toString()); } public ServerErrorException(String message, String code) { super(message); ErrorId id = new ErrorId(code); this.severity = id.getSeverity(); this.code = code; } public ServerErrorException(String message, int code) { super(message); this.code = Integer.toString(code); } public int getSeverity() { return severity; } public String getCode() { return code; } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#2 | 18866 | Sven Erik Knop | Updated with latest version | ||
#1 | 9795 | Sven Erik Knop |
Populate //guest/sven_erik_knop/p4search/... from //guest/perforce_software/p4search/.... |
||
//guest/perforce_software/p4search/search/webapp/src/main/java/com/perforce/p4java/extension/exception/ServerErrorException.java | |||||
#1 | 8975 | Matt Attaway | Populate official version of p4-search from the original Doug Scheirer source |