removed dependencies
This commit is contained in:
32
err.go
Normal file
32
err.go
Normal file
@@ -0,0 +1,32 @@
|
||||
package scn
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type ErrorType string
|
||||
|
||||
var (
|
||||
ErrAuthFailed ErrorType = "GOEXT_SCN_AUTHFAILED"
|
||||
ErrQuota ErrorType = "GOEXT_SCN_QUOTAEXCEEDED"
|
||||
ErrBadRequest ErrorType = "GOEXT_SCN_BADREQUEST"
|
||||
ErrInternalServerErr ErrorType = "GOEXT_SCN_INTERNALSERVER"
|
||||
ErrOther ErrorType = "GOEXT_SCN_OTHER"
|
||||
)
|
||||
|
||||
type InternalError struct {
|
||||
errType ErrorType
|
||||
errorMessage string
|
||||
}
|
||||
|
||||
func NewError(errType ErrorType, errMessage string) *InternalError {
|
||||
return &InternalError{
|
||||
errType: errType,
|
||||
errorMessage: errMessage,
|
||||
}
|
||||
}
|
||||
|
||||
func (e *InternalError) Build() error {
|
||||
return errors.New(fmt.Sprintf("[%v]: %v", e.errType, e.errorMessage))
|
||||
}
|
||||
Reference in New Issue
Block a user