Skip to content

Commit af55e02

Browse files
committed
Record user info on client-side errors too
1 parent 045f5cc commit af55e02

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/libraries/Logger.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public static function getIdentity() {
2727

2828
public static function getIdentityAsRollbar() {
2929
$user = self::getIdentity();
30+
if (!$user) { return null; }
3031
return [
3132
'email' => $user->getEmail(),
3233
'id' => $user->getId(),

src/templates/rollbar.inc.js.phtml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
<?php namespace BNETDocs\Templates; use CarlBennett\MVC\Libraries\Common; ?>
1+
<?php namespace BNETDocs\Templates;
2+
use BNETDocs\Libraries\Logger;
3+
use CarlBennett\MVC\Libraries\Common;
4+
?>
25
<script>
36
var _rollbarConfig = {
47
accessToken: "<?php echo Common::$config->rollbar->access_token_client; ?>",
58
captureUncaught: true,
69
captureUnhandledRejections: true,
710
payload: {
8-
environment: "<?php echo Common::$config->rollbar->environment; ?>"
11+
environment: "<?php echo Common::$config->rollbar->environment; ?>",
12+
person: <?php echo json_encode(Logger::getIdentityAsRollbar()); ?>
913
}
1014
};
1115
// Rollbar Snippet

0 commit comments

Comments
 (0)