diff --git a/define.go b/define.go index 6c67382..e7f8918 100644 --- a/define.go +++ b/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 */