The Error code now has a Code field that exposes the YARA API error code to Go users, and also exposes the error codes as constants that can be used in Go code (example: err.Code == yara.ERROR_TIMEOUT). Sometimes is useful to get a numeric error code instead of a text string.
When Error is converted to a string, it includes the name of the rule causing the error. For example, instead of getting an error like syntax error, unexpected identifier, expecting <condition>, you get rule \"foo\": syntax error, unexpected identifier, expecting <condition>.
This introduces the following changes.:
The
Error
code now has aCode
field that exposes the YARA API error code to Go users, and also exposes the error codes as constants that can be used in Go code (example:err.Code == yara.ERROR_TIMEOUT
). Sometimes is useful to get a numeric error code instead of a text string.When
Error
is converted to a string, it includes the name of the rule causing the error. For example, instead of getting an error likesyntax error, unexpected identifier, expecting <condition>
, you getrule \"foo\": syntax error, unexpected identifier, expecting <condition>
.