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

Avoid failing to process a message if one regex fails #28

Closed
Krinkle opened this issue Oct 13, 2017 · 1 comment
Closed

Avoid failing to process a message if one regex fails #28

Krinkle opened this issue Oct 13, 2017 · 1 comment
Assignees
Milestone

Comments

@Krinkle
Copy link
Member

Krinkle commented Oct 13, 2017

When processing an event from RCReader, and one of the regexes on the BES is for some reason corrupt, we currently throw and not catch it until the outer try/catch from RCReader.rcirc_OnChannelMessage which then decides to ignore the message and move on.

Oct 13 00:04:19 cvn-app8 CVNBot.exe[8766]: ERROR [RCReader] CVNBot.RCReader Failed to handle RCEvent

System.ArgumentException: parsing "(?:A[^\A-z0-9]N[^\A-z0-9]A[^\A-z0-9]N[^\A-z0-9]I[^\A-z0-9]Z[^\A-z0-9]I|__ping__:Vito-Genovese, HakanIST)" - Unrecognized escape sequence \A.
at System.Text.RegularExpressions.RegexParser.ScanCharEscape ()
at System.Text.RegularExpressions.RegexParser.ScanCharClass (..)
at System.Text.RegularExpressions.RegexParser.CountCaptures ()
at System.Text.RegularExpressions.RegexParser.Parse (..)
at System.Text.RegularExpressions.Regex..ctor (..)
at System.Text.RegularExpressions.Regex.IsMatch (..)
at System.Text.RegularExpressions.Regex.IsMatch (..)
at CVNBot.ListManager.matchesList (System.String title, System.Int32 list) 
at CVNBot.Program.ReactToRCEvent (CVNBot.RCEvent r)
at CVNBot.RCReader.rcirc_OnChannelMessage (System.Object sender, Meebey.SmartIrc4net.IrcEventArgs e)

Instead, we should catch these within ListManager.matchesList and just return false, the same way as if the regex was working but didn't match (which is the most common case).

@Krinkle
Copy link
Member Author

Krinkle commented Oct 13, 2017

Pushed out a fix on the experimental 1.22.0-alpha branch for Mono 4, which is what CVNBot12 (cvn-wp-nl) currently runs on.

@Krinkle Krinkle added this to the 1.22.0 milestone Oct 13, 2017
@Krinkle Krinkle closed this as completed Oct 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant