mirror of
https://github.com/DreamExposure/DisCal-Discord-Bot.git
synced 2026-01-24 04:48:27 -06:00
Fix some error handling logic
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user