You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/provider.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,11 +37,11 @@ The first thing the provider should do, is to check whether the `IEvent` is one
37
37
38
38
```php
39
39
if ($event->getApp() !== 'files' || $event->getType() !== 'favorite') {
40
-
throw new \InvalidArgumentException();
40
+
throw new \OCP\Activity\Exceptions\UnknownActivityException();
41
41
}
42
42
```
43
43
44
-
Whenever a provider throws an `\InvalidArgumentException` the activity app will continue and pass the event to the next provider, so this should always be thrown when the event is unknown.
44
+
Whenever a provider throws an `UnknownActivityException` (*Added in Nextcloud 30, before throw `\InvalidArgumentException`*), the activity app will continue and pass the event to the next provider, so this should always be thrown when the event is unknown.
@@ -75,7 +76,11 @@ public function addEvent(int $id, IEvent $event): void {
75
76
} else {
76
77
$event = $provider->parse($language, $event);
77
78
}
78
-
} catch (\InvalidArgumentException$e) {
79
+
} catch (UnknownActivityException) {
80
+
} catch (\InvalidArgumentException) {
81
+
// todo 33.0.0 Log as warning
82
+
// todo 39.0.0 Log as error
83
+
$this->logger->debug(get_class($provider) . '::parse() threw \InvalidArgumentException which is deprecated. Throw \OCP\Activity\Exceptions\UnknownActivityException when the event is not known to your provider and otherwise handle all \InvalidArgumentException yourself.');
79
84
} catch (\Throwable$e) {
80
85
$this->logger->error('Error while parsing activity event', ['exception' => $e]);
$this->logger->debug(get_class($provider) . '::parse() threw \InvalidArgumentException which is deprecated. Throw \OCP\Activity\Exceptions\UnknownActivityException when the event is not known to your provider and otherwise handle all \InvalidArgumentException yourself.');
0 commit comments