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