restgolanggowhatsapp-multi-devicewhatsapp-apiwhatsappwhatsapp-web-multi-devicewhatsapp-api-gorest-apigolang-whatsapp-apigolang-whatsappbot
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.
29 lines
474 B
29 lines
474 B
package utils
|
|
|
|
import "fmt"
|
|
|
|
func PanicIfNeeded(err interface{}, message ...string) {
|
|
if err != nil {
|
|
if fmt.Sprintf("%s", err) == "record not found" && len(message) > 0 {
|
|
panic(message[0])
|
|
} else {
|
|
panic(err)
|
|
}
|
|
}
|
|
}
|
|
|
|
type ValidationError struct {
|
|
Message string
|
|
}
|
|
|
|
func (validationError ValidationError) Error() string {
|
|
return validationError.Message
|
|
}
|
|
|
|
type AuthError struct {
|
|
Message string
|
|
}
|
|
|
|
func (err AuthError) Error() string {
|
|
return err.Message
|
|
}
|