A clean, Markdown-based publishing platform made for writers. Write together, and build a community. https://writefreely.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

45 lines
2.8 KiB

  1. package writefreely
  2. import (
  3. "github.com/writeas/impart"
  4. "net/http"
  5. )
  6. // Commonly returned HTTP errors
  7. var (
  8. ErrBadFormData = impart.HTTPError{http.StatusBadRequest, "Expected valid form data."}
  9. ErrBadJSON = impart.HTTPError{http.StatusBadRequest, "Expected valid JSON object."}
  10. ErrBadJSONArray = impart.HTTPError{http.StatusBadRequest, "Expected valid JSON array."}
  11. ErrBadAccessToken = impart.HTTPError{http.StatusUnauthorized, "Invalid access token."}
  12. ErrNoAccessToken = impart.HTTPError{http.StatusBadRequest, "Authorization token required."}
  13. ErrNotLoggedIn = impart.HTTPError{http.StatusUnauthorized, "Not logged in."}
  14. ErrForbiddenCollection = impart.HTTPError{http.StatusForbidden, "You don't have permission to add to this collection."}
  15. ErrForbiddenEditPost = impart.HTTPError{http.StatusForbidden, "You don't have permission to update this post."}
  16. ErrUnauthorizedEditPost = impart.HTTPError{http.StatusUnauthorized, "Invalid editing credentials."}
  17. ErrUnauthorizedGeneral = impart.HTTPError{http.StatusUnauthorized, "You don't have permission to do that."}
  18. ErrBadRequestedType = impart.HTTPError{http.StatusNotAcceptable, "Bad requested Content-Type."}
  19. ErrCollectionUnauthorizedRead = impart.HTTPError{http.StatusUnauthorized, "You don't have permission to access this collection."}
  20. ErrNoPublishableContent = impart.HTTPError{http.StatusBadRequest, "Supply something to publish."}
  21. ErrInternalGeneral = impart.HTTPError{http.StatusInternalServerError, "The humans messed something up. They've been notified."}
  22. ErrInternalCookieSession = impart.HTTPError{http.StatusInternalServerError, "Could not get cookie session."}
  23. ErrCollectionNotFound = impart.HTTPError{http.StatusNotFound, "Collection doesn't exist."}
  24. ErrCollectionGone = impart.HTTPError{http.StatusGone, "This blog was unpublished."}
  25. ErrCollectionPageNotFound = impart.HTTPError{http.StatusNotFound, "Collection page doesn't exist."}
  26. ErrPostNotFound = impart.HTTPError{Status: http.StatusNotFound, Message: "Post not found."}
  27. ErrPostBanned = impart.HTTPError{Status: http.StatusGone, Message: "Post removed."}
  28. ErrPostUnpublished = impart.HTTPError{Status: http.StatusGone, Message: "Post unpublished by author."}
  29. ErrPostFetchError = impart.HTTPError{Status: http.StatusInternalServerError, Message: "We encountered an error getting the post. The humans have been alerted."}
  30. ErrUserNotFound = impart.HTTPError{http.StatusNotFound, "User doesn't exist."}
  31. ErrUserNotFoundEmail = impart.HTTPError{http.StatusNotFound, "Please enter your username instead of your email address."}
  32. )
  33. // Post operation errors
  34. var (
  35. ErrPostNoUpdatableVals = impart.HTTPError{http.StatusBadRequest, "Supply some properties to update."}
  36. )