Skip to content

Commit c7564bc

Browse files
committed
Add 401 Unauthorized.
1 parent c2e227d commit c7564bc

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

solga/src/Solga.hs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ module Solga
4141
-- * Error handling
4242
, SolgaError
4343
, badRequest
44+
, unauthorized
4445
, notFound
4546
, internalServerError
4647
-- * Router implementation
@@ -366,6 +367,13 @@ badRequest msg = SolgaError
366367
, errorMessage = msg
367368
}
368369

370+
-- | Create a @401 Unauthorized@ error with a given message.
371+
unauthorized :: Text.Text -> SolgaError
372+
unauthorized msg = SolgaError
373+
{ errorStatus = HTTP.unauthorized401
374+
, errorMessage = msg
375+
}
376+
369377
-- | Create a @404 Not Found@ error with a given message.
370378
notFound :: Text.Text -> SolgaError
371379
notFound msg = SolgaError

0 commit comments

Comments
 (0)