Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package io.confluent.rest.exceptions;

import javax.ws.rs.core.Response;

public class RestServerErrorException extends RestException {

public RestServerErrorException(String message, int errorCode) {
this(message, errorCode, null);
}

public RestServerErrorException(String message, int errorCode, Throwable cause) {
super(message, Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), errorCode, cause);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

import io.confluent.rest.entities.ErrorMessage;
import io.confluent.rest.exceptions.RestNotFoundException;
import io.confluent.rest.exceptions.RestServerErrorException;

import static org.junit.Assert.assertEquals;

Expand Down Expand Up @@ -86,7 +87,7 @@ public void testNonRestException() {
public void testUnexpectedException() {
// Under non-debug mode, this uses a completely generic message since unexpected errors
// is the one case we want to be certain we don't leak extra info
testAppException("/unexpected", 500, 500,
testAppException("/unexpected", 500, 50001,
Response.Status.INTERNAL_SERVER_ERROR.getReasonPhrase());
}

Expand Down Expand Up @@ -122,7 +123,7 @@ public String notFound() {
@GET
@Path("/unexpected")
public String unexpected() {
throw new RuntimeException("Internal server error.");
throw new RestServerErrorException("Internal Server Error", 50001);
}
}

Expand Down