Stringify error messages.
This commit is contained in:
parent
5c9e7c0ba2
commit
809db0b902
20
define.go
20
define.go
@ -128,8 +128,24 @@ const CL_INIT_DEFAULT C.uint = C.CL_INIT_DEFAULT
|
||||
|
||||
// Wraps the corresponding error message
|
||||
func Strerr(code ErrorCode) error {
|
||||
err := errors.New(fmt.Sprintf("Error %d", C.int(code)))
|
||||
return err
|
||||
switch code {
|
||||
case CL_VIRUS:
|
||||
return errors.New("Virus detected")
|
||||
case CL_EUNPACK:
|
||||
return errors.New("Unpacking failed")
|
||||
case CL_EVERIFY:
|
||||
return errors.New("Verification failed")
|
||||
case CL_ECVD:
|
||||
return errors.New("CVD database error")
|
||||
case CL_EOPEN:
|
||||
case CL_EACCES:
|
||||
case CL_EREAD:
|
||||
case CL_ESTAT:
|
||||
return errors.New("I/O error while scanning file.")
|
||||
default:
|
||||
return errors.New(fmt.Sprintf("Error %d", C.int(code)))
|
||||
}
|
||||
return errors.New("Unknown error")
|
||||
}
|
||||
|
||||
/* db options */
|
||||
|
Loading…
Reference in New Issue
Block a user