Class ResponseStatusException2
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
org.springframework.core.NestedRuntimeException
org.springframework.web.ErrorResponseException
org.springframework.web.server.ResponseStatusException
uk.ac.ebi.utils.opt.springweb.exceptions.ResponseStatusException2
- All Implemented Interfaces:
- Serializable,- org.springframework.web.ErrorResponse
public class ResponseStatusException2
extends org.springframework.web.server.ResponseStatusException
An alternative version of 
ResponseStatusException that yields a more compact and better-formatted
 getMessage(). Throw this in place of ResponseStatusException if you prefer our flavour of it.- Author:
- brandizi
 - Date:
- 9 Jun 2021
 
- See Also:
- 
Nested Class SummaryNested classes/interfaces inherited from interface org.springframework.web.ErrorResponseorg.springframework.web.ErrorResponse.Builder, org.springframework.web.ErrorResponse.Interceptor
- 
Constructor SummaryConstructorsConstructorDescriptionResponseStatusException2(int rawStatusCode, String reason, Throwable cause) ResponseStatusException2(org.springframework.http.HttpStatus status) ResponseStatusException2(org.springframework.http.HttpStatus status, String reason) ResponseStatusException2(org.springframework.http.HttpStatus status, String reason, Throwable cause) 
- 
Method SummaryModifier and TypeMethodDescriptionReturns something like: "User not found (HTTP 404 NOT_FOUND)" The first part isResponseStatusException.getReason(), if null, it tries to getHttpStatus.getReasonPhrase()from, if this is null too, the second part only is reported without any braces.invalid reference#getStatus()Methods inherited from class org.springframework.web.server.ResponseStatusExceptiongetHeaders, getReason, getResponseHeaders, updateAndGetBodyMethods inherited from class org.springframework.web.ErrorResponseExceptiongetBody, getDetailMessageArguments, getDetailMessageCode, getStatusCode, setDetail, setInstance, setTitle, setTypeMethods inherited from class org.springframework.core.NestedRuntimeExceptioncontains, getMostSpecificCause, getRootCauseMethods inherited from class java.lang.ThrowableaddSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toStringMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.web.ErrorResponsegetDetailMessageArguments, getTitleMessageCode, getTypeMessageCode
- 
Constructor Details- 
ResponseStatusException2public ResponseStatusException2(org.springframework.http.HttpStatus status) 
- 
ResponseStatusException2
- 
ResponseStatusException2
- 
ResponseStatusException2
 
- 
- 
Method Details- 
getMessageReturns something like: "User not found (HTTP 404 NOT_FOUND)" The first part isResponseStatusException.getReason(), if null, it tries to getHttpStatus.getReasonPhrase()from, if this is null too, the second part only is reported without any braces. Ifinvalid reference#getStatus()only is available, the second part reports the int code only. This version of the message getter doesn't yield the cause's message and this is up to you to pass it in the constructor.invalid reference#getRawStatusCode()- Overrides:
- getMessagein class- org.springframework.web.server.ResponseStatusException
 
 
-