2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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.so.adapters.vfc.exceptions;
23 import javax.ws.rs.core.Response;
25 public class ApplicationException extends Exception {
30 private static final long serialVersionUID = 1L;
32 private int errorCode;
34 private String errorMsg;
41 * @param errorCode error status
42 * @param errorMsg error detail
43 * @since ONAP Amsterdam Release 2017-9-6
45 public ApplicationException(int errorCode, String errorMsg) {
46 this.errorCode = errorCode;
47 this.errorMsg = errorMsg;
50 public int getErrorCode() {
54 public void setErrorCode(int errorCode) {
55 this.errorCode = errorCode;
58 public String getErrorMsg() {
62 public void setErrorMsg(String errorMsg) {
63 this.errorMsg = errorMsg;
67 * build error Response <br>
70 * @since ONAP Amsterdam Release
72 public Response buildErrorResponse() {
73 return Response.status(errorCode).entity(errorMsg).build();