Package com.brihaspathee.zeus.exception
Class ApiErrorHandler
java.lang.Object
com.brihaspathee.zeus.exception.ApiErrorHandler
Created in Intellij IDEA
User: Balaji Varadharajan
Date: 14, July 2022
Time: 8:16 PM
Project: Zeus
Package Name: com.brihaspathee.zeus.exception
To change this template use File | Settings | File and Code Template
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<com.brihaspathee.zeus.web.response.ZeusApiResponse<com.brihaspathee.zeus.exception.ApiExceptionList>>handleAccessDeniedException(org.springframework.security.access.AccessDeniedException exception) Method is used to handle the access denied exception This is when the user is authenticated but is not authorized to perform the requested operationorg.springframework.http.ResponseEntity<com.brihaspathee.zeus.web.response.ZeusApiResponse<com.brihaspathee.zeus.exception.ApiExceptionList>>handleBadCredentialsException(org.springframework.security.authentication.BadCredentialsException exception) Handles the bad credentials exception.org.springframework.http.ResponseEntity<com.brihaspathee.zeus.web.response.ZeusApiResponse<com.brihaspathee.zeus.exception.ApiExceptionList>>handleClientErrorException(org.springframework.web.client.HttpClientErrorException exception) Occurs when a user is not authenticated to access the API endpoint
-
Constructor Details
-
ApiErrorHandler
public ApiErrorHandler()
-
-
Method Details
-
handleBadCredentialsException
@ExceptionHandler(org.springframework.security.authentication.BadCredentialsException.class) public org.springframework.http.ResponseEntity<com.brihaspathee.zeus.web.response.ZeusApiResponse<com.brihaspathee.zeus.exception.ApiExceptionList>> handleBadCredentialsException(org.springframework.security.authentication.BadCredentialsException exception) throws com.fasterxml.jackson.core.JsonProcessingException Handles the bad credentials exception. This exception is generated when an invalid password is provided by the user- Parameters:
exception-- Returns:
- Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
handleAccessDeniedException
@ExceptionHandler(org.springframework.security.access.AccessDeniedException.class) public org.springframework.http.ResponseEntity<com.brihaspathee.zeus.web.response.ZeusApiResponse<com.brihaspathee.zeus.exception.ApiExceptionList>> handleAccessDeniedException(org.springframework.security.access.AccessDeniedException exception) throws com.fasterxml.jackson.core.JsonProcessingException Method is used to handle the access denied exception This is when the user is authenticated but is not authorized to perform the requested operation- Parameters:
exception-- Returns:
- Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
handleClientErrorException
@ExceptionHandler(org.springframework.web.client.HttpClientErrorException.class) public org.springframework.http.ResponseEntity<com.brihaspathee.zeus.web.response.ZeusApiResponse<com.brihaspathee.zeus.exception.ApiExceptionList>> handleClientErrorException(org.springframework.web.client.HttpClientErrorException exception) throws com.fasterxml.jackson.core.JsonProcessingException Occurs when a user is not authenticated to access the API endpoint- Parameters:
exception-- Returns:
- Throws:
com.fasterxml.jackson.core.JsonProcessingException
-