Skip to content

Commit

Permalink
Add 402: Payment Required
Browse files Browse the repository at this point in the history
  • Loading branch information
joemasilotti committed Mar 20, 2024
1 parent e0176f8 commit c1cf254
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions turbo/src/main/kotlin/dev/hotwire/turbo/errors/HttpError.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ sealed interface HttpError : TurboVisitError {
override val reasonPhrase = "Unauthorized"
}

data object PaymentRequired : ClientError {
override val statusCode = 402
override val reasonPhrase = "Payment Required"
}

data object Forbidden : ClientError {
override val statusCode = 403
override val reasonPhrase = "Forbidden"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class HttpErrorTest : BaseUnitTest() {
val errors = listOf(
400 to ClientError.BadRequest,
401 to ClientError.Unauthorized,
402 to ClientError.PaymentRequired,
403 to ClientError.Forbidden,
404 to ClientError.NotFound,
405 to ClientError.MethodNotAllowed,
Expand Down

0 comments on commit c1cf254

Please sign in to comment.