catch errors when parsing calendar data for calendar query requests#6901
catch errors when parsing calendar data for calendar query requests#6901MorrisJobke merged 1 commit intomasterfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## master #6901 +/- ##
============================================
- Coverage 50.86% 50.85% -0.01%
- Complexity 24534 24538 +4
============================================
Files 1584 1584
Lines 93778 93803 +25
Branches 1358 1358
============================================
+ Hits 47696 47705 +9
- Misses 46082 46098 +16
|
| // catch parsing errors | ||
| try { | ||
| $matches = $this->validateFilterForObject($row, $filters); | ||
| } catch(\Exception $ex) { |
There was a problem hiding this comment.
Maybe catch only Sabre\VObject\ParseException ? Since it can also throw Sabre\DAV\Exception\NotImplemented and Sabre\DAV\Exception\BadRequest (inside Sabre\DAV\CalendarQueryValidator) which shouldn't be logged as an error.
There was a problem hiding this comment.
I was considering, but sadly it's not very well documented (at least i didn't find something), what exceptions can be thrown. In the bug report it was InvalidDataException.
And the pity is, that there is no real hierarchy but all inherit from \Exception
There was a problem hiding this comment.
You could check against the known (base) classes and if it's an unkown once you just re-throw it.
| $matches = $this->validateFilterForObject($row, $filters); | ||
| } catch(\Exception $ex) { | ||
| $this->logger->error('Catched parsing exception for calendar data. This indicates invalid calendar data. URI:' . $row['uri']); | ||
| $this->logger->logException($ex); |
There was a problem hiding this comment.
please combine those two:
$this->logger->logException($ex, [
'app' => 'dav',
'message' => 'Catched parsing exception for calendar data. This indicates invalid calendar data. URI:' . $row['uri'],
);172eb88 to
1b9dfa3
Compare
|
done |
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
1b9dfa3 to
ea117ba
Compare
|
Fixed merge conflict in |
fixes #4014