01: /**
02: * Copyright (c) 2007, Aberystwyth University
03: *
04: * All rights reserved.
05: *
06: * Redistribution and use in source and binary forms, with or without
07: * modification, are permitted provided that the following conditions
08: * are met:
09: *
10: * - Redistributions of source code must retain the above
11: * copyright notice, this list of conditions and the
12: * following disclaimer.
13: *
14: * - Redistributions in binary form must reproduce the above copyright
15: * notice, this list of conditions and the following disclaimer in
16: * the documentation and/or other materials provided with the
17: * distribution.
18: *
19: * - Neither the name of the Centre for Advanced Software and
20: * Intelligent Systems (CASIS) nor the names of its
21: * contributors may be used to endorse or promote products derived
22: * from this software without specific prior written permission.
23: *
24: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25: * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26: * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
27: * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
28: * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29: * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
30: * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
32: * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
33: * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
34: * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35: * SUCH DAMAGE.
36: */package org.purl.sword.base;
37:
38: /**
39: * Represents a generic SWORD exception. If this thrown by a repository,
40: * it would result in a HTTP 500 message being returned to the user.
41: *
42: * @author Stuart Lewis
43: * @author Neil Taylor
44: */
45: public class SWORDException extends Exception {
46: private String errorCode;
47:
48: /**
49: * Create a new instance and store the specified message and source data.
50: *
51: * @param message The message for the exception.
52: * @param source The original exception that lead to this exception. This
53: * can be <code>null</code>.
54: */
55: public SWORDException(String message, Exception source) {
56: super (message, source);
57: }
58:
59: /**
60: * Create a new instance and store the specified message and source data.
61: *
62: * @param message The message for the exception.
63: * @param source The original exception that lead to this exception. This
64: * can be <code>null</code>.
65: * @param errorCode The error code to sed back with the request
66: */
67: public SWORDException(String message, Exception source,
68: String errorCode) {
69: super (message, source);
70: this .errorCode = errorCode;
71: }
72:
73: /**
74: * Create a new instance and store the specified message.
75: *
76: * @param message The message for the exception.
77: */
78: public SWORDException(String message) {
79: super (message);
80: }
81:
82: /**
83: * Get the error code
84: *
85: * @return The error code
86: */
87: public String getErrorCode() {
88: return errorCode;
89: }
90: }
|