Fix some error handling logic

This commit is contained in:
NovaFox161
2022-01-15 15:11:17 -06:00
parent 8e8c6d3d74
commit 9b8d03095c
2 changed files with 2 additions and 6 deletions

View File

@@ -114,11 +114,11 @@ object GoogleAuth {
if (body.error == "invalid_grant") {
LOGGER.debug(DEFAULT, "[Google] Access to resource has been revoked")
Mono.error<CredentialData>(AccessRevokedException())
Mono.error(AccessRevokedException())
} else {
LOGGER.debug(DEFAULT, "[Google] Error requesting new access token | ${response.code} | ${response.message} | $body")
Mono.empty()
}
Mono.empty()
}
else -> {
// Failed to get OK. Send debug info

View File

@@ -17,8 +17,6 @@ import org.springframework.core.annotation.Order
import org.springframework.http.HttpStatus
import org.springframework.http.MediaType
import org.springframework.web.client.HttpClientErrorException
import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException
import org.springframework.web.server.MethodNotAllowedException
import org.springframework.web.server.ResponseStatusException
import org.springframework.web.server.ServerWebExchange
import reactor.core.publisher.Mono
@@ -59,9 +57,7 @@ class GlobalErrorHandler : ErrorWebExceptionHandler {
exchange.response.statusCode = HttpStatus.FORBIDDEN
RestError.ACCESS_REVOKED
}
is MethodNotAllowedException,
is TypeMismatchException,
is MethodArgumentTypeMismatchException,
is SerializationException -> {
exchange.response.statusCode = HttpStatus.BAD_REQUEST
RestError.BAD_REQUEST