agui icon indicating copy to clipboard operation
agui copied to clipboard

MODIFIED: Filter Logging System Panic

Open Sommos opened this issue 2 years ago • 1 comments

You are calling unwrap() on the result of a parse(). The unwrap() function returns the value inside an Ok variant, but if the Result is an Err, it will cause the program to panic and terminate.

Pull request type

Potential Bug Fix

Please check the type of change your PR introduces:

  • [X] Bugfix
  • [ ] Feature
  • [ ] Code style update (formatting, renaming)
  • [ ] Refactoring (no functional changes, no api changes)
  • [ ] Build related changes
  • [ ] Documentation content changes
  • [ ] Other (please describe):

What is the current behavior?

Currently, calling unwrap() on the result of parse() within these filters can cause the program to panic and terminate if an Err is returned instead of the expected Ok.

Issue Number: N/A

What is the new behavior?

  • Now, it should handle an Err Result far more cleanly, with a proper error message, instead of panicing and terminating the whole program.

Other information

N/A

Sommos avatar Dec 17 '23 23:12 Sommos

Technically yes, but the likelyhood of this failing to parse is zero since it's guaranteed to be well-formed. Generally .unwrap() is "fine" if you're positive it's a safe operation

Stumblinbear avatar Dec 18 '23 10:12 Stumblinbear