1 package org.apache.archiva.rest.api.services.v2;/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing,
12 * software distributed under the License is distributed on an
13 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 * KIND, either express or implied. See the License for the
15 * specific language governing permissions and limitations
19 import java.util.ArrayList;
20 import java.util.List;
23 * Generic REST Service Exception that contains error information.
25 * @author Martin Stockhammer <martin_s@apache.org>
28 public class ArchivaRestServiceException extends Exception
30 private int httpErrorCode = 500;
32 private List<ErrorMessage> errorMessages = new ArrayList<ErrorMessage>(0);
34 public ArchivaRestServiceException( String s )
39 public ArchivaRestServiceException( String s, int httpErrorCode )
42 this.httpErrorCode = httpErrorCode;
45 public ArchivaRestServiceException( ErrorMessage errorMessage )
47 errorMessages.add( errorMessage );
50 public ArchivaRestServiceException( ErrorMessage errorMessage, int httpResponseCode )
52 this.httpErrorCode = httpResponseCode;
53 errorMessages.add( errorMessage );
56 public ArchivaRestServiceException( List<ErrorMessage> errorMessage )
58 errorMessages.addAll( errorMessage );
61 public ArchivaRestServiceException( List<ErrorMessage> errorMessage, int httpResponseCode )
63 this.httpErrorCode = httpResponseCode;
64 errorMessages.addAll( errorMessage );
67 public int getHttpErrorCode()
72 public void setHttpErrorCode( int httpErrorCode )
74 this.httpErrorCode = httpErrorCode;
77 public List<ErrorMessage> getErrorMessages()
79 if ( errorMessages == null )
81 this.errorMessages = new ArrayList<ErrorMessage>();
86 public void setErrorMessages( List<ErrorMessage> errorMessages )
88 this.errorMessages = errorMessages;
91 public void addErrorMessage( ErrorMessage errorMessage )
93 this.errorMessages.add( errorMessage );