-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathsimple_oauth-drupal11-watchdog-exception.patch
More file actions
49 lines (45 loc) · 2.4 KB
/
simple_oauth-drupal11-watchdog-exception.patch
File metadata and controls
49 lines (45 loc) · 2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
diff --git a/src/Controller/Oauth2Token.php b/src/Controller/Oauth2Token.php
--- a/src/Controller/Oauth2Token.php
+++ b/src/Controller/Oauth2Token.php
@@ -69,7 +69,7 @@ class Oauth2Token extends ControllerBase {
$response = $this->handleToken($request, $auth_server);
}
catch (OAuthServerException $exception) {
- watchdog_exception('simple_oauth', $exception);
+ $this->getLogger('simple_oauth')->error($exception->getMessage(), ['exception' => $exception]);
$response = $exception->generateHttpResponse(new Response());
}
return $response;
diff --git a/src/Authentication/Provider/SimpleOauthAuthenticationProvider.php b/src/Authentication/Provider/SimpleOauthAuthenticationProvider.php
--- a/src/Authentication/Provider/SimpleOauthAuthenticationProvider.php
+++ b/src/Authentication/Provider/SimpleOauthAuthenticationProvider.php
@@ -4,6 +4,7 @@ namespace Drupal\simple_oauth\Authentication\Provider;
use Drupal\Core\Authentication\AuthenticationProviderInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
+use Drupal\Core\Logger\LoggerChannelTrait;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\simple_oauth\Authentication\TokenAuthUser;
use Drupal\simple_oauth\PageCache\SimpleOauthRequestPolicyInterface;
@@ -18,6 +19,7 @@ use Symfony\Component\HttpKernel\Exception\HttpException;
class SimpleOauthAuthenticationProvider implements AuthenticationProviderInterface {
use StringTranslationTrait;
+ use LoggerChannelTrait;
/**
* @var \Drupal\simple_oauth\Server\ResourceServerInterface
@@ -79,7 +81,7 @@ class SimpleOauthAuthenticationProvider implements AuthenticationProviderInterfa
}
catch (OAuthServerException $exception) {
// Procedural code here is hard to avoid.
- watchdog_exception('simple_oauth', $exception);
+ $this->getLogger('simple_oauth')->error($exception->getMessage(), ['exception' => $exception]);
throw new HttpException(
$exception->getHttpStatusCode(),
@@ -106,7 +108,7 @@ class SimpleOauthAuthenticationProvider implements AuthenticationProviderInterfa
['%name' => $account->getAccountName()]
)
);
- watchdog_exception('simple_oauth', $exception);
+ $this->getLogger('simple_oauth')->error($exception->getMessage(), ['exception' => $exception]);
throw new HttpException(
$exception->getHttpStatusCode(),
$exception->getHint(),