blob: cbcbd278bf8cb76e120172d7540251f1d5293863 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.http.server.jetty;
/**
* This exception may be thrown from a request handler to fail a request with a given response code and message.
* It is given some special treatment in {@link ServletResponseController}.
*
* @author <a href="mailto:bakksjo@yahoo-inc.com">Oyvind Bakksjo</a>
*/
class RequestException extends RuntimeException {
private final int responseStatus;
/**
* @param responseStatus the response code to use for the http response
* @param message exception message
* @param cause chained throwable
*/
public RequestException(final int responseStatus, final String message, final Throwable cause) {
super(message, cause);
this.responseStatus = responseStatus;
}
/**
* @param responseStatus the response code to use for the http response
* @param message exception message
*/
public RequestException(final int responseStatus, final String message) {
super(message);
this.responseStatus = responseStatus;
}
/**
* Returns the response code to use for the http response.
*/
public int getResponseStatus() {
return responseStatus;
}
}
|