Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions errors/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const (
ErrTypeJSON = "JSON Error"
ErrTypeAuth = "Auth Error"
ErrTypeTokenStore = "Token Store Error"
ErrTypeYAML = "YAML Error"
)

type Error struct {
Expand Down Expand Up @@ -74,6 +75,10 @@ func NewJSONError(cause error) *Error {
return NewError(ErrTypeJSON, cause.Error(), cause)
}

func NewYAMLError(cause error) *Error {
return NewError(ErrTypeYAML, cause.Error(), cause)
}

func NewAuthError(message string, cause error) *Error {
return NewError(ErrTypeAuth, message, cause)
}
Expand All @@ -95,3 +100,4 @@ func IsIOError(err error) bool { return IsErrorType(err, ErrTypeIO) }
func IsAPIError(err error) bool { return IsErrorType(err, ErrTypeAPI) }
func IsJSONError(err error) bool { return IsErrorType(err, ErrTypeJSON) }
func IsAuthError(err error) bool { return IsErrorType(err, ErrTypeAuth) }
func IsYAMLError(err error) bool { return IsErrorType(err, ErrTypeYAML) }
Loading