2 * ============LICENSE_START====================================================
\r
4 * ===========================================================================
\r
5 * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
\r
6 * ===========================================================================
\r
7 * Licensed under the Apache License, Version 2.0 (the "License");
\r
8 * you may not use this file except in compliance with the License.
\r
9 * You may obtain a copy of the License at
\r
11 * http://www.apache.org/licenses/LICENSE-2.0
\r
13 * Unless required by applicable law or agreed to in writing, software
\r
14 * distributed under the License is distributed on an "AS IS" BASIS,
\r
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
16 * See the License for the specific language governing permissions and
\r
17 * limitations under the License.
\r
18 * ============LICENSE_END====================================================
\r
22 package org.onap.aaf.misc.env;
\r
26 * An Exception with the ability to hold a payload.<p>
\r
28 * This is important, because sometimes, the output of a Framework
\r
29 * may be a descriptive object which doesn't inherit from Throwable
\r
30 * and thus cannot be attached in "initCause".<p>
\r
32 * Examples may be a SOAP Fault.
\r
37 public class APIException extends Exception {
\r
39 private Object payload = null;
\r
44 public APIException(Throwable t) {
\r
51 public APIException(String string) {
\r
56 * @param errorMessage
\r
59 public APIException(String errorMessage, Throwable t) {
\r
60 super(errorMessage,t);
\r
64 * Return payload, or null if none was set. Type is up to the calling
\r
69 public Object getPayload() {
\r
74 * Set a specific payload into this Exception, which doesn't necessarily
\r
75 * inherit from Throwable.
\r
78 * @return APIException
\r
80 public APIException setPayload(Object payload) {
\r
81 this.payload = payload;
\r
86 * Java expected serial ID
\r
88 private static final long serialVersionUID = 3505343458251445169L;
\r