Stringify error messages.

This commit is contained in:
Yvan Janssens 2023-04-07 13:39:35 +02:00
parent 5c9e7c0ba2
commit 809db0b902

View File

@ -128,8 +128,24 @@ const CL_INIT_DEFAULT C.uint = C.CL_INIT_DEFAULT
// Wraps the corresponding error message // Wraps the corresponding error message
func Strerr(code ErrorCode) error { func Strerr(code ErrorCode) error {
err := errors.New(fmt.Sprintf("Error %d", C.int(code))) switch code {
return err 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 */ /* db options */