Skip to content

Commit

Permalink
Merge pull request #27 from lammertw/exception-cause
Browse files Browse the repository at this point in the history
Add cause to InvalidCognitoAccessTokenException
  • Loading branch information
gaebel authored Jun 16, 2021
2 parents d0afc5e + aa704af commit 59957eb
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.json.Json

class InvalidCognitoAccessTokenException(message:String): Exception(message)
class InvalidCognitoAccessTokenException(message: String, cause: Throwable): Exception(message, cause)

@Serializable
data class CognitoAccessTokenClaims(
Expand Down Expand Up @@ -37,7 +37,7 @@ class CognitoAccessToken(accessTokenString: String): JWT<CognitoAccessTokenClaim
try {
return Json.decodeFromString(CognitoAccessTokenClaims.serializer(), getPayload())
} catch (e: Exception) {
throw InvalidCognitoAccessTokenException("This is not a valid access token")
throw InvalidCognitoAccessTokenException("This is not a valid access token", e)
}
}
}

0 comments on commit 59957eb

Please sign in to comment.