Merge pull request #1698 from yesodweb/documentErrorResponse

Document ErrorResponse
This commit is contained in:
Michael Snoyman 2020-10-07 09:14:08 +03:00 committed by GitHub
commit bcae4c99b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 1 deletions

View File

@ -1,5 +1,9 @@
# ChangeLog for yesod-core
## 1.6.18.5
Document `ErrorResponse` [#1698](https://github.com/yesodweb/yesod/pull/1698)
## 1.6.18.4
* Fixed a bug where `mkYesod` and other TH functions didn't work for datatypes with explicitly stated type variables, including the case with typeclass constraints. [https://github.com/yesodweb/yesod/pull/1697](#1697)

View File

@ -326,11 +326,28 @@ newtype DontFullyEvaluate a = DontFullyEvaluate { unDontFullyEvaluate :: a }
-- | Responses to indicate some form of an error occurred.
data ErrorResponse =
NotFound
-- ^ The requested resource was not found.
-- Examples of when this occurs include when an incorrect URL is used, or @yesod-persistent@'s 'get404' doesn't find a value.
-- HTTP status: 404.
| InternalError !Text
-- ^ Some sort of unexpected exception.
-- If your application uses `throwIO` or `error` to throw an exception, this is the form it would take.
-- HTTP status: 500.
| InvalidArgs ![Text]
-- ^ Indicates some sort of invalid or missing argument, like a missing query parameter or malformed JSON body.
-- Examples Yesod functions that send this include 'requireCheckJsonBody' and @Yesod.Auth.GoogleEmail2@.
-- HTTP status: 400.
| NotAuthenticated
-- ^ Indicates the user is not logged in.
-- This is thrown when 'isAuthorized' returns 'AuthenticationRequired'.
-- HTTP code: 401.
| PermissionDenied !Text
-- ^ Indicates the user doesn't have permission to access the requested resource.
-- This is thrown when 'isAuthorized' returns 'Unauthorized'.
-- HTTP code: 403.
| BadMethod !H.Method
-- ^ Indicates the URL would have been valid if used with a different HTTP method (e.g. a GET was used, but only POST is handled.)
-- HTTP code: 405.
deriving (Show, Eq, Generic)
instance NFData ErrorResponse

View File

@ -1,5 +1,5 @@
name: yesod-core
version: 1.6.18.4
version: 1.6.18.5
license: MIT
license-file: LICENSE
author: Michael Snoyman <michael@snoyman.com>