whatsapp-multi-devicewhatsapp-apiwhatsapprestgolanggogolang-whatsappbotwhatsapp-web-multi-devicewhatsapp-api-gorest-apigolang-whatsapp-api
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.
77 lines
1.9 KiB
77 lines
1.9 KiB
package error
|
|
|
|
import "net/http"
|
|
|
|
type InvalidJID string
|
|
|
|
// Error for complying the error interface
|
|
func (e InvalidJID) Error() string {
|
|
return string(e)
|
|
}
|
|
|
|
// ErrCode will return the error code based on the error data type
|
|
func (e InvalidJID) ErrCode() string {
|
|
return "INVALID_JID"
|
|
}
|
|
|
|
// StatusCode will return the HTTP status code based on the error data type
|
|
func (e InvalidJID) StatusCode() int {
|
|
return http.StatusBadRequest
|
|
}
|
|
|
|
type WebhookError string
|
|
|
|
// Error for complying the error interface
|
|
func (e WebhookError) Error() string {
|
|
return string(e)
|
|
}
|
|
|
|
// ErrCode will return the error code based on the error data type
|
|
func (e WebhookError) ErrCode() string {
|
|
return "WEBHOOK_ERROR"
|
|
}
|
|
|
|
// StatusCode will return the HTTP status code based on the error data type
|
|
func (e WebhookError) StatusCode() int {
|
|
return http.StatusInternalServerError
|
|
}
|
|
|
|
type WaCliError string
|
|
|
|
// Error for complying the error interface
|
|
func (e WaCliError) Error() string {
|
|
return string(e)
|
|
}
|
|
|
|
// ErrCode will return the error code based on the error data type
|
|
func (e WaCliError) ErrCode() string {
|
|
return "INVALID_WA_CLI"
|
|
}
|
|
|
|
// StatusCode will return the HTTP status code based on the error data type
|
|
func (e WaCliError) StatusCode() int {
|
|
return http.StatusInternalServerError
|
|
}
|
|
|
|
type WaUploadMediaError string
|
|
|
|
// Error for complying the error interface
|
|
func (e WaUploadMediaError) Error() string {
|
|
return string(e)
|
|
}
|
|
|
|
// ErrCode will return the error code based on the error data type
|
|
func (e WaUploadMediaError) ErrCode() string {
|
|
return "UPLOAD_MEDIA_ERROR"
|
|
}
|
|
|
|
// StatusCode will return the HTTP status code based on the error data type
|
|
func (e WaUploadMediaError) StatusCode() int {
|
|
return http.StatusInternalServerError
|
|
}
|
|
|
|
const (
|
|
ErrInvalidJID = InvalidJID("your JID is invalid")
|
|
ErrUserNotRegistered = InvalidJID("user is not registered")
|
|
ErrWaCLI = WaCliError("your WhatsApp CLI is invalid or empty")
|
|
)
|