blob: eea69cd7f748b1466787acbf4a0f7e8190b1b159 (
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 2017 Yahoo Holdings. 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 bakksjo
*/
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;
}
}
|