001/*-------------------------------------------------------------------------+
002|                                                                          |
003| Copyright 2005-2011 the ConQAT Project                                   |
004|                                                                          |
005| Licensed under the Apache License, Version 2.0 (the "License");          |
006| you may not use this file except in compliance with the License.         |
007| You may obtain a copy of the License at                                  |
008|                                                                          |
009|    http://www.apache.org/licenses/LICENSE-2.0                            |
010|                                                                          |
011| Unless required by applicable law or agreed to in writing, software      |
012| distributed under the License is distributed on an "AS IS" BASIS,        |
013| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
014| See the License for the specific language governing permissions and      |
015| limitations under the License.                                           |
016+-------------------------------------------------------------------------*/
017package org.conqat.engine.service.shared.client;
018
019/**
020 * Exception used for failing service calls.
021 */
022public class ServiceCallException extends Exception {
023
024        /** Version for serialization. */
025        private static final long serialVersionUID = 1;
026
027        /** The status code of the server response. */
028        private int statusCode = 0;
029
030        /** The body of the server response. */
031        private String requestBody = null;
032
033        public ServiceCallException(String message, int statusCode, String requestBody) {
034                this(message);
035                this.statusCode = statusCode;
036                this.requestBody = requestBody;
037        }
038
039        public ServiceCallException(String message) {
040                super(message);
041        }
042
043        public ServiceCallException(String message, Throwable cause) {
044                super(message, cause);
045        }
046
047        public ServiceCallException(Throwable cause) {
048                super(cause);
049        }
050
051        /** @see #statusCode */
052        public int getStatusCode() {
053                return statusCode;
054        }
055
056        /** @see #requestBody */
057        public String getRequestBody() {
058                return requestBody;
059        }
060}