Implement Vuls's own error code (#812)

* add error pkg

* fix fmt format

* fix NewError -> New

* fix err msg format
This commit is contained in:
sadayuki-matsuno
2019-05-15 17:42:09 +09:00
committed by Kota Kanbe
parent 53aaea9fe2
commit 98fee7b5d2
2 changed files with 32 additions and 2 deletions

27
errof/errof.go Normal file
View File

@@ -0,0 +1,27 @@
package errof
// ErrorCode is vuls error code
type ErrorCode string
// Error is vuls error
type Error struct {
Code ErrorCode
Message string
}
func (e Error) Error() string {
return e.Message
}
var (
// ErrFailedToAccessGithubAPI is error of github alert's api access
ErrFailedToAccessGithubAPI ErrorCode = "ErrFailedToAccessGithubAPI"
)
// New :
func New(code ErrorCode, msg string) Error {
return Error{
Code: code,
Message: msg,
}
}