2018-12-24 17:45:15 +00:00
/ *
2020-02-08 17:55:10 +00:00
* Copyright © 2018 - 2020 A Bunch Tell LLC .
2018-12-24 17:45:15 +00: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 06:05:26 +00:00
2018-10-17 00:30:38 +00:00
package writefreely
import (
"net/http"
2019-08-28 19:37:45 +00:00
"github.com/writeas/impart"
2018-10-17 00:30:38 +00:00
)
// Commonly returned HTTP errors
var (
2018-11-08 06:31:01 +00: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-17 02:31:27 +00:00
ErrBadAccessToken = impart . HTTPError { http . StatusUnauthorized , "Invalid access token." }
ErrNoAccessToken = impart . HTTPError { http . StatusBadRequest , "Authorization token required." }
2018-11-08 06:31:01 +00:00
ErrNotLoggedIn = impart . HTTPError { http . StatusUnauthorized , "Not logged in." }
2018-10-17 02:31:27 +00:00
2018-11-08 06:31:01 +00: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-17 02:31:27 +00:00
2018-11-08 06:31:01 +00:00
ErrNoPublishableContent = impart . HTTPError { http . StatusBadRequest , "Supply something to publish." }
2018-10-17 02:31:27 +00:00
2018-11-08 06:31:01 +00: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 20:14:05 +00:00
ErrUnavailable = impart . HTTPError { http . StatusServiceUnavailable , "Service temporarily unavailable due to high load." }
2018-11-08 06:31:01 +00:00
ErrCollectionNotFound = impart . HTTPError { http . StatusNotFound , "Collection doesn't exist." }
ErrCollectionGone = impart . HTTPError { http . StatusGone , "This blog was unpublished." }
2018-10-17 02:31:27 +00:00
ErrCollectionPageNotFound = impart . HTTPError { http . StatusNotFound , "Collection page doesn't exist." }
ErrPostNotFound = impart . HTTPError { Status : http . StatusNotFound , Message : "Post not found." }
2018-11-08 06:31:01 +00:00
ErrPostBanned = impart . HTTPError { Status : http . StatusGone , Message : "Post removed." }
2018-10-17 02:31:27 +00: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 17:55:10 +00: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 19:37:45 +00:00
2019-11-11 23:21:45 +00:00
ErrUserSilenced = impart . HTTPError { http . StatusForbidden , "Account is silenced." }
2018-10-17 02:31:27 +00:00
)
// Post operation errors
var (
ErrPostNoUpdatableVals = impart . HTTPError { http . StatusBadRequest , "Supply some properties to update." }
2018-10-17 00:30:38 +00:00
)