-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…119)
- Loading branch information
Ivan Senic
authored
Feb 16, 2023
1 parent
7cafaa6
commit ff24e79
Showing
4 changed files
with
41 additions
and
29 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
src/main/java/io/stargate/sgv2/jsonapi/api/exception/WebApplicationExceptionMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package io.stargate.sgv2.jsonapi.api.exception; | ||
|
||
import io.stargate.sgv2.jsonapi.api.model.command.CommandResult; | ||
import io.stargate.sgv2.jsonapi.exception.mappers.ThrowableCommandResultSupplier; | ||
import javax.ws.rs.WebApplicationException; | ||
import org.jboss.resteasy.reactive.RestResponse; | ||
import org.jboss.resteasy.reactive.server.ServerExceptionMapper; | ||
|
||
/** Tries to omit the `WebApplicationException` and just report the cause. */ | ||
public class WebApplicationExceptionMapper { | ||
|
||
@ServerExceptionMapper | ||
public RestResponse<CommandResult> genericExceptionMapper(WebApplicationException e) { | ||
Throwable toReport = null != e.getCause() ? e.getCause() : e; | ||
CommandResult commandResult = new ThrowableCommandResultSupplier(toReport).get(); | ||
return RestResponse.ok(commandResult); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters