Skip to content

Commit

Permalink
fix: Status.RESOURCE_EXHAUSTED wasn't handled
Browse files Browse the repository at this point in the history
  • Loading branch information
y9vad9 committed Jul 26, 2023
1 parent eb450b6 commit b42dc46
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import io.timemates.sdk.common.exceptions.InternalServerError
import io.timemates.sdk.common.exceptions.InvalidArgumentException
import io.timemates.sdk.common.exceptions.NotFoundException
import io.timemates.sdk.common.exceptions.PermissionDeniedException
import io.timemates.sdk.common.exceptions.TooManyRequestsException
import io.timemates.sdk.common.exceptions.UnauthorizedException
import io.timemates.sdk.common.exceptions.UnavailableException
import io.timemates.sdk.common.exceptions.UnsupportedException
Expand Down Expand Up @@ -383,6 +384,9 @@ public class GrpcTimeMatesRequestsEngine(
val message = exception.message ?: NO_MESSAGE

when (status) {
Status.RESOURCE_EXHAUSTED ->
TooManyRequestsException("Too many requests.", exception)

Status.INVALID_ARGUMENT, Status.FAILED_PRECONDITION ->
InvalidArgumentException(message, exception)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ package io.timemates.sdk.common.exceptions
*/
public data class TooManyRequestsException(
override val message: String,
override val cause: Throwable?,
) : TimeMatesException(message)

0 comments on commit b42dc46

Please sign in to comment.