File size: 3,097 Bytes
d834a80
 
 
 
 
 
 
 
 
 
ca18868
 
d834a80
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44c4b7e
 
 
 
 
 
f7fe55b
44c4b7e
 
 
 
 
 
 
 
 
 
c099d87
 
 
 
d834a80
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
package http_error

import "errors"

var (
	BAD_REQUEST_ERROR           = errors.New("Invalid Request Format !")
	INTERNAL_SERVER_ERROR       = errors.New("Internal Server Error!")
	UNAUTHORIZED                = errors.New("Unauthorized, you don't have permission to access this service!")
	DATA_NOT_FOUND              = errors.New("There is not data with given credential / given parameter!")
	TIMEOUT                     = errors.New("Server took to long respond!")
	FORBIDDEN                   = errors.New("Forbidden action!")
	ERR_INVALID_CSRF            = errors.New("Invalid CSRF token")
	EXISTING_ACCOUNT            = errors.New("There is existing account!")
	INVALID_TOKEN               = errors.New("Invalid Authentication Payload!")
	DUPLICATE_DATA              = errors.New("Duplicate data !")
	ACCOUNT_NOT_FOUND           = errors.New("There is no account with given credential!")
	WRONG_PASSWORD              = errors.New("Your password is wrong for given account credential, please recheck!")
	INVALID_ACCOUNT_DIGITS      = errors.New("Your account 3 digits is not found in account number data")
	EXPIRED_TOKEN               = errors.New("Token expired")
	ALREADY_REGISTERED_TO_EVENT = errors.New("Account already registered to this event")
	EMAIL_ALREADY_EXISTS        = errors.New("Email already registered")
	NOT_REGISTERED_TO_EVENT     = errors.New("Account is not registered to this event")
	INVALID_OTP                 = errors.New("Invalid OTP Code")
	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 were disallowed to do the exam!")
	EVENT_NOT_STARTED           = errors.New("Take it easy, event hasn't starting yet! you cannot do the exam!")
	EXAMS_SUBMITTED             = errors.New("You've submitted the exam, you were diasallowed to answer the question!")

	// Auth Errors
	ERR_USER_ALREADY_EXISTS     = errors.New("User already exists")
	ERR_TOKEN_GENERATION_FAILED = errors.New("Failed to generate token")
	ERR_USER_NOT_FOUND          = errors.New("User not found")
	ERR_WRONG_PASSWORD          = errors.New("Wrong password")
	ERR_REGISTRATION_DISABLED   = errors.New("Registration is currently disabled")

	// WhatsApp Connection Errors
	ERR_INVALID_ACCOUNT_ID       = errors.New("Invalid account ID format")
	ERR_CLIENT_INIT_FAILED       = errors.New("Failed to initialize WhatsApp client")
	ERR_CLIENT_CONNECT_FAILED    = errors.New("Failed to connect to WhatsApp socket")
	ERR_CLIENT_NOT_FOUND_FOR_ACC = errors.New("WhatsApp client not found for this account")
	ERR_INVALID_JID              = errors.New("Invalid JID format")
	ERR_DB_CONNECTION_FAILED     = errors.New("Failed to get database connection")
	ERR_SQLSTORE_FAILED          = errors.New("Failed to initialize SQL store")
	ERR_DEVICE_STORE_FAILED      = errors.New("Failed to retrieve device from store")

	// Chat Errors
	ERR_CLIENT_NOT_CONNECTED = errors.New("WhatsApp client is not connected")
	ERR_BAD_REQUEST          = errors.New("Bad request")
)