Log out information from DOMException when import fails (#1923)

This should give us the information we're looking for when imports fail
mysteriously!

https://developer.mozilla.org/en-US/docs/Web/API/DOMException
This commit is contained in:
Scott Nonnenberg 2018-01-04 16:26:41 -08:00 committed by GitHub
parent 8fd0adc486
commit 66aa76e501
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 95 additions and 73 deletions

View file

@ -1,6 +1,37 @@
'use strict';
describe('Backup', function() {
describe('handleDOMException', function() {
it('handles null, still calls reject', function() {
var called = 0;
var reject = function() {
called += 1;
};
var error = null;
var prefix = 'something';
Whisper.Backup.handleDOMException(prefix, error, reject);
assert.strictEqual(called, 1);
});
it('handles object code and message', function() {
var called = 0;
var reject = function() {
called += 1;
};
var error = {
code: 4,
message: 'some cryptic error',
};
var prefix = 'something';
Whisper.Backup.handleDOMException(prefix, error, reject);
assert.strictEqual(called, 1);
});
});
describe('sanitizeFileName', function() {
it('leaves a basic string alone', function() {
var initial = 'Hello, how are you #5 (\'fine\' + great).jpg';