Better logging for Twitter bridge account linking process

This commit is contained in:
Zach Copley 2010-02-17 19:24:38 +00:00
parent 3cb6b1670b
commit 6b887728b2

View File

@ -131,8 +131,7 @@ class TwitterauthorizationAction extends Action
} else if ($this->arg('connect')) { } else if ($this->arg('connect')) {
$this->connectNewUser(); $this->connectNewUser();
} else { } else {
common_debug('Twitter Connect Plugin - ' . common_debug('Twitter bridge - ' . print_r($this->args, true));
print_r($this->args, true));
$this->showForm(_('Something weird happened.'), $this->showForm(_('Something weird happened.'),
$this->trimmed('newname')); $this->trimmed('newname'));
} }
@ -172,9 +171,15 @@ class TwitterauthorizationAction extends Action
$auth_link = $client->getAuthorizeLink($req_tok, $this->signin); $auth_link = $client->getAuthorizeLink($req_tok, $this->signin);
} catch (OAuthClientException $e) { } catch (OAuthClientException $e) {
$msg = sprintf('OAuth client error - code: %1s, msg: %2s', $msg = sprintf(
$e->getCode(), $e->getMessage()); 'OAuth client error - code: %1s, msg: %2s',
$this->serverError(_m('Couldn\'t link your Twitter account.')); $e->getCode(),
$e->getMessage()
);
common_log(LOG_INFO, 'Twitter bridge - ' . $msg);
$this->serverError(
_m('Couldn\'t link your Twitter account: ') . $e->getMessage()
);
} }
common_redirect($auth_link); common_redirect($auth_link);
@ -192,7 +197,9 @@ class TwitterauthorizationAction extends Action
// token we sent them // token we sent them
if ($_SESSION['twitter_request_token'] != $this->oauth_token) { if ($_SESSION['twitter_request_token'] != $this->oauth_token) {
$this->serverError(_m('Couldn\'t link your Twitter account.')); $this->serverError(
_m('Couldn\'t link your Twitter account: oauth_token mismatch.')
);
} }
$twitter_user = null; $twitter_user = null;
@ -212,9 +219,15 @@ class TwitterauthorizationAction extends Action
$twitter_user = $client->verifyCredentials(); $twitter_user = $client->verifyCredentials();
} catch (OAuthClientException $e) { } catch (OAuthClientException $e) {
$msg = sprintf('OAuth client error - code: %1$s, msg: %2$s', $msg = sprintf(
$e->getCode(), $e->getMessage()); 'OAuth client error - code: %1$s, msg: %2$s',
$this->serverError(_m('Couldn\'t link your Twitter account.')); $e->getCode(),
$e->getMessage()
);
common_log(LOG_INFO, 'Twitter bridge - ' . $msg);
$this->serverError(
_m('Couldn\'t link your Twitter account: ') . $e-getMessage()
);
} }
if (common_logged_in()) { if (common_logged_in()) {