diff --git a/grpc-engine/src/main/kotlin/io/timemates/api/grpc/GrpcTimeMatesRequestsEngine.kt b/grpc-engine/src/main/kotlin/io/timemates/api/grpc/GrpcTimeMatesRequestsEngine.kt index 9f8d230..c1e58e3 100644 --- a/grpc-engine/src/main/kotlin/io/timemates/api/grpc/GrpcTimeMatesRequestsEngine.kt +++ b/grpc-engine/src/main/kotlin/io/timemates/api/grpc/GrpcTimeMatesRequestsEngine.kt @@ -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 @@ -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) diff --git a/sdk/src/commonMain/kotlin/io/timemates/sdk/common/exceptions/TooManyRequestsException.kt b/sdk/src/commonMain/kotlin/io/timemates/sdk/common/exceptions/TooManyRequestsException.kt index b9bd897..730c4c1 100644 --- a/sdk/src/commonMain/kotlin/io/timemates/sdk/common/exceptions/TooManyRequestsException.kt +++ b/sdk/src/commonMain/kotlin/io/timemates/sdk/common/exceptions/TooManyRequestsException.kt @@ -9,4 +9,5 @@ package io.timemates.sdk.common.exceptions */ public data class TooManyRequestsException( override val message: String, + override val cause: Throwable?, ) : TimeMatesException(message) \ No newline at end of file