1 /*******************************************************************************
2 * Copyright (c) 2007, 2014 Massimiliano Ziccardi
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *******************************************************************************/
16 package it.jnrpe.plugins;
17
18 import it.jnrpe.Status;
19
20 /**
21 * This is the exception that must be thrown if an error occurs gathering
22 * metrics.
23 *
24 * @author Massimiliano Ziccardi
25 *
26 */
27 public class MetricGatheringException extends Exception {
28
29 /**
30 *
31 */
32 private static final long serialVersionUID = -8799905566378155453L;
33
34 /**
35 * The status to return to Nagios.
36 */
37 private final Status returnStatus;
38
39 /**
40 * Builds and initializes the exception.
41 *
42 * @param message
43 * The message to return to Nagios.
44 * @param status
45 * The status to return to Nagios.
46 * @param cause
47 * The original cause of the error.
48 */
49 public MetricGatheringException(final String message, final Status status,
50 final Throwable cause) {
51 super(message, cause);
52 returnStatus = status;
53 }
54
55 /**
56 * @return The status to be returned to Nagios.
57 */
58 public final Status getStatus() {
59 return returnStatus;
60 }
61
62 }