feat(CAD): Make it easier to find `.smsStatus` errors in the logs. (#5121) r=@philbooth

Add an `.smsStatus` suffix to the error context, which is included
in messages sent to DataDog, e.g.,:

error.verify-email.smsStatus.auth.999

issue #5109
This commit is contained in:
Shane Tomlinson 2017-06-01 22:07:47 +01:00 коммит произвёл GitHub
Родитель d4c0343c74
Коммит c20bc4c020
2 изменённых файлов: 8 добавлений и 1 удалений

Просмотреть файл

@ -145,6 +145,9 @@ define((require, exports, module) => {
return country;
}
}, (err) => {
// Add `.smsStatus` to the context so we can differentiate between errors
// checking smsStatus from other XHR errors that occur in the consumer modules.
err.context = `${this.getViewName()}.smsStatus`;
// Log and throw away errors from smsStatus, it shouldn't
// prevent verification from completing. Send the user to
// /connect_another_device instead. See #5109

Просмотреть файл

@ -24,7 +24,8 @@ define(function (require, exports, module) {
const VALID_UID = createRandomHexString(Constants.UID_LENGTH);
var View = BaseView.extend({
template: Template
template: Template,
viewName: 'connect-another-device'
});
Cocktail.mixin(
@ -187,8 +188,11 @@ define(function (require, exports, module) {
assert.isTrue(view._areSmsRequirementsMet.calledWith(account));
assert.isTrue(account.smsStatus.calledOnce);
assert.isTrue(account.smsStatus.calledWith({ country: 'US' }));
assert.isTrue(view.logError.calledOnce);
assert.isTrue(view.logError.calledWith(err));
// context is updated to include extra `.smsStatus` for reporting.
assert.equal(err.context, 'connect-another-device.smsStatus');
});
});
});