Spaces:
Runtime error
Runtime error
File size: 5,701 Bytes
ab82ffd 483bf6a 38100fe 987726a 4f74c7d 483bf6a 38100fe 124871e 1b4f42f 483bf6a ab82ffd 38100fe 423c422 7d3a71d b03de03 987726a 875ef91 483bf6a 636dafc 483bf6a 38100fe 483bf6a 38100fe c0722d3 e6440b2 c0722d3 4f74c7d 39f8903 c0722d3 40f1c60 f2b94bf 7af3ebd 636dafc | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | package http_error
import "errors"
var (
// ================= GENERAL =================
BAD_REQUEST_ERROR = errors.New("Invalid request format")
INTERNAL_SERVER_ERROR = errors.New("Internal server error")
TIMEOUT = errors.New("Server took too long to respond")
NOT_FOUND_ERROR = errors.New("Resource not found")
DUPLICATE_DATA = errors.New("Duplicate data")
INVALID_DATA_PAYLOAD = errors.New("Invalid data payload provided")
DATA_NOT_FOUND = errors.New("Data not found")
FORBIDDEN_ERROR = errors.New("Forbidden, you don't have permission to access this service")
PRIVILEGE_REQUIRED = errors.New("privilege_required")
// ================= AUTH & ACCOUNT =================
UNAUTHORIZED = errors.New("Unauthorized, you don't have permission to access this service")
EXISTING_ACCOUNT = errors.New("Account already exists")
INVALID_TOKEN = errors.New("Invalid authentication payload")
ACCOUNT_NOT_FOUND = errors.New("There is no account with the given credentials")
WRONG_PASSWORD = errors.New("Invalid password, please check your credentials")
INVALID_ACCOUNT_DIGITS = errors.New("Your account 3 digits is not found in account number data")
EXPIRED_TOKEN = errors.New("Token expired")
INVALID_OTP = errors.New("Invalid OTP code")
EMAIL_ALREADY_EXISTS = errors.New("Email already registered")
EMAIL_NOT_VERIFIED = errors.New("Email is not verified")
MAILGUN_CONFIG_ERROR = errors.New("Mail service configuration is incomplete")
SEND_EMAIL_FAILED = errors.New("Failed to send verification email")
// ================= EVENT & EXAM =================
ALREADY_REGISTERED_TO_EVENT = errors.New("Account already registered to this event")
NOT_REGISTERED_TO_EVENT = errors.New("Account is not registered to this event")
ERR_PROBLEM_SET_NOT_FOUND = errors.New("Problem set not found")
ERR_QUESTION_NOT_FOUND = errors.New("Question not found")
EVENT_FINISHED = errors.New("The event has ended, you are disallowed to take the exam")
EVENT_NOT_STARTED = errors.New("Take it easy, event hasn't started yet! You cannot take the exam")
EXAMS_SUBMITTED = errors.New("You have submitted the exam, you are disallowed to answer the question")
EXAMS_TIME_EXCEEDED = errors.New("Time limit exceeded for this attempt")
IMAGE_REQUIRED = errors.New("Image is required")
DESCRIPTION_REQUIRED = errors.New("Description is required")
CODE_REQUIRED = errors.New("Code is required")
INVALID_CODE = errors.New("Code must be on range 6-12")
EVENT_START_DATE_INVALID = errors.New("Event start date must be in the future")
EVENT_END_DATE_INVALID = errors.New("Event end date must be after start date")
INVALID_DATE_FORMAT = errors.New("Invalid date format, please use RFC3339")
EVENT_START_DATE_IN_PAST = errors.New("Event start date cannot be in the past")
INVALID_QUESTION_TYPE = errors.New("Invalid question type")
// ================= FILE UPLOAD =================
FILE_TOO_LARGE = errors.New("File size exceeds the maximum limit")
INVALID_FILE_TYPE = errors.New("File type is not permitted for the selected context")
UPLOAD_FAILED = errors.New("Failed to upload file to storage provider")
PARTIAL_UPLOAD_FAILURE = errors.New("Some files failed validation or upload")
INVALID_UPLOAD_CONTEXT_ERROR = errors.New("Invalid upload context")
// ================= ACADEMY =================
TITLE_REQUIRED = errors.New("Title cannot be empty")
SLUG_REQUIRED = errors.New("Slug cannot be empty")
ACADEMY_ID_REQUIRED = errors.New("Academy ID is required")
MATERIAL_ID_REQUIRED = errors.New("Material ID is required")
ACADEMY_NOT_FOUND = errors.New("Academy not found")
MATERIAL_NOT_FOUND = errors.New("Material not found")
CONTENT_NOT_FOUND = errors.New("Content not found")
ACADEMY_HAS_MATERIALS = errors.New("Cannot delete academy because it still has materials")
MATERIAL_HAS_CONTENTS = errors.New("Cannot delete material because it still has contents")
SOURCE_ACADEMY_NOT_FOUND = errors.New("source academy not found")
BATCH_SIZE_EXCEEDED = errors.New("batch size exceeded")
PROBLEM_SET_NOT_FOUND = errors.New("problem set not found")
QUESTION_NOT_FOUND = errors.New("question not found")
NO_QUESTIONS_SELECTED = errors.New("no_questions_selected")
QUESTION_NOT_ANSWERABLE = errors.New("description question is not answerable")
NO_EXAMS_SELECTED = errors.New("no_exams_selected")
PAYMENT_FAILED = errors.New("There is error during payment process try again later!")
PAYMENT_REQUIRED = errors.New("Payment is required to access this content")
PAYMENT_GATEWAY_ERROR = errors.New("Payment gateway returned an invalid response")
PAYMENT_CUSTOMER_EMAIL_MISSING = errors.New("email is required to create payment invoice")
PAYMENT_CUSTOMER_PHONE_MISSING = errors.New("phone number is required to create payment invoice")
// ================= RBAC ROLES =================
HIERARCHY_VIOLATION = errors.New("hierarchy_violation")
ROLE_IMMUTABLE = errors.New("role_immutable")
ROLE_NAME_TAKEN = errors.New("role_name_taken")
ROLE_IN_USE = errors.New("role_in_use")
LAST_SUPERADMIN = errors.New("last_superadmin")
// ================= ORGANIZATION =================
ORGANIZATION_SLUG_TAKEN = errors.New("organization_slug_taken")
ORGANIZATION_NOT_EMPTY = errors.New("organization_not_empty")
ORGANIZATION_NOT_FOUND = errors.New("organization_not_found")
)
|