2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 - 2019 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=========================================================
21 package org.onap.vid.model;
25 import static com.att.eelf.configuration.Configuration.MDC_KEY_REQUEST_ID;
28 * The Class ExceptionResponse.
30 public class ExceptionResponse {
32 public ExceptionResponse() {
36 private String exception;
39 private String message;
41 public ExceptionResponse(String exception, String message) {
42 this.exception = exception;
43 this.message = message;
46 public ExceptionResponse(Exception exception) {
47 setException(exception);
53 * @return the exception
55 public String getException() {
62 * @param exception the new exception
64 public void setException(String exception) {
65 this.exception = exception;
68 public void setException(Exception exception) {
69 setException(exception.getClass().toString().replaceFirst("^.*[\\.$]", ""));
70 setMessage(exception.getMessage() + " (Request id: " + MDC.get(MDC_KEY_REQUEST_ID) + ")");
78 public String getMessage() {
85 * @param message the new message
87 public void setMessage(String message) {
88 this.message = message;