Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance the Error type to provide more information about the error. #134

Merged
merged 1 commit into from
Nov 8, 2023

Conversation

plusvic
Copy link
Contributor

@plusvic plusvic commented Nov 8, 2023

This introduces the following changes.:

  • 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 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>`.
@hillu
Copy link
Owner

hillu commented Nov 8, 2023

awesome, thank you!

@hillu hillu merged commit fdb067a into hillu:master Nov 8, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants