2018-12-24 12:45:15 -05:00
/ *
2020-02-08 12:55:10 -05:00
* Copyright © 2018 - 2020 A Bunch Tell LLC .
2018-12-24 12:45:15 -05:00
*
* This file is part of WriteFreely .
*
* WriteFreely is free software : you can redistribute it and / or modify
* it under the terms of the GNU Affero General Public License , included
* in the LICENSE file in this source code package .
* /
2018-12-31 01:05:26 -05:00
2018-10-16 20:30:38 -04:00
package writefreely
import (
"net/http"
2019-08-28 12:37:45 -07:00
"github.com/writeas/impart"
2018-10-16 20:30:38 -04:00
)
// Commonly returned HTTP errors
var (
2018-11-08 01:31:01 -05:00
ErrBadFormData = impart . HTTPError { http . StatusBadRequest , "Expected valid form data." }
ErrBadJSON = impart . HTTPError { http . StatusBadRequest , "Expected valid JSON object." }
ErrBadJSONArray = impart . HTTPError { http . StatusBadRequest , "Expected valid JSON array." }
2018-10-16 22:31:27 -04:00
ErrBadAccessToken = impart . HTTPError { http . StatusUnauthorized , "Invalid access token." }
ErrNoAccessToken = impart . HTTPError { http . StatusBadRequest , "Authorization token required." }
2018-11-08 01:31:01 -05:00
ErrNotLoggedIn = impart . HTTPError { http . StatusUnauthorized , "Not logged in." }
2018-10-16 22:31:27 -04:00
2018-11-08 01:31:01 -05:00
ErrForbiddenCollection = impart . HTTPError { http . StatusForbidden , "You don't have permission to add to this collection." }
ErrForbiddenEditPost = impart . HTTPError { http . StatusForbidden , "You don't have permission to update this post." }
ErrUnauthorizedEditPost = impart . HTTPError { http . StatusUnauthorized , "Invalid editing credentials." }
ErrUnauthorizedGeneral = impart . HTTPError { http . StatusUnauthorized , "You don't have permission to do that." }
ErrBadRequestedType = impart . HTTPError { http . StatusNotAcceptable , "Bad requested Content-Type." }
ErrCollectionUnauthorizedRead = impart . HTTPError { http . StatusUnauthorized , "You don't have permission to access this collection." }
2018-10-16 22:31:27 -04:00
2018-11-08 01:31:01 -05:00
ErrNoPublishableContent = impart . HTTPError { http . StatusBadRequest , "Supply something to publish." }
2018-10-16 22:31:27 -04:00
2018-11-08 01:31:01 -05:00
ErrInternalGeneral = impart . HTTPError { http . StatusInternalServerError , "The humans messed something up. They've been notified." }
ErrInternalCookieSession = impart . HTTPError { http . StatusInternalServerError , "Could not get cookie session." }
2020-03-18 16:14:05 -04:00
ErrUnavailable = impart . HTTPError { http . StatusServiceUnavailable , "Service temporarily unavailable due to high load." }
2018-11-08 01:31:01 -05:00
ErrCollectionNotFound = impart . HTTPError { http . StatusNotFound , "Collection doesn't exist." }
ErrCollectionGone = impart . HTTPError { http . StatusGone , "This blog was unpublished." }
2018-10-16 22:31:27 -04:00
ErrCollectionPageNotFound = impart . HTTPError { http . StatusNotFound , "Collection page doesn't exist." }
ErrPostNotFound = impart . HTTPError { Status : http . StatusNotFound , Message : "Post not found." }
2018-11-08 01:31:01 -05:00
ErrPostBanned = impart . HTTPError { Status : http . StatusGone , Message : "Post removed." }
2018-10-16 22:31:27 -04:00
ErrPostUnpublished = impart . HTTPError { Status : http . StatusGone , Message : "Post unpublished by author." }
ErrPostFetchError = impart . HTTPError { Status : http . StatusInternalServerError , Message : "We encountered an error getting the post. The humans have been alerted." }
2020-02-08 12:55:10 -05:00
ErrUserNotFound = impart . HTTPError { http . StatusNotFound , "User doesn't exist." }
ErrRemoteUserNotFound = impart . HTTPError { http . StatusNotFound , "Remote user not found." }
ErrUserNotFoundEmail = impart . HTTPError { http . StatusNotFound , "Please enter your username instead of your email address." }
2019-08-28 12:37:45 -07:00
2019-11-11 15:21:45 -08:00
ErrUserSilenced = impart . HTTPError { http . StatusForbidden , "Account is silenced." }
2020-06-14 00:27:25 +02:00
ErrDisabledPasswordAuth = impart . HTTPError { http . StatusForbidden , "Password authentication is disabled." }
2018-10-16 22:31:27 -04:00
)
// Post operation errors
var (
ErrPostNoUpdatableVals = impart . HTTPError { http . StatusBadRequest , "Supply some properties to update." }
2018-10-16 20:30:38 -04:00
)