Skip to content

Commit 2f90d7b

Browse files
committed
special message for error sending email
1 parent e28047d commit 2f90d7b

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

plugins/emailstore.js

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@
5252
code: 406,
5353
message: 'User quota exceeded',
5454
},
55-
COULD_NOT_CREATE: {
56-
code: 500,
57-
message: 'Could not create profile',
55+
ERROR_SENDING_EMAIL: {
56+
code: 501,
57+
message: 'Could not send verification email',
5858
},
5959
};
6060

@@ -359,11 +359,11 @@
359359
emailPlugin.sendVerificationEmail(email, secret, function (err, res) {
360360
if (err) {
361361
logger.error('error sending verification email', email, secret, err);
362-
return callback(emailPlugin.errors.INTERNAL_ERROR);
362+
return callback(emailPlugin.errors.ERROR_SENDING_EMAIL);
363363
}
364+
return callback();
364365
});
365366
}
366-
callback();
367367
});
368368
};
369369

@@ -536,10 +536,7 @@
536536
*/
537537
function(callback) {
538538
emailPlugin.saveEncryptedData(email, key, record, function(err) {
539-
if (err) {
540-
return callback(err);
541-
}
542-
return callback();
539+
return callback(err);
543540
});
544541
},
545542
/**
@@ -551,17 +548,16 @@
551548
emailPlugin.createVerificationSecretAndSendEmail(email, function(err) {
552549
if (err) {
553550
errorCreating = true;
554-
return callback(err);
555551
}
556-
return callback();
552+
return callback(err);
557553
});
558554
},
559555
],
560556
function(err) {
561557
if (err) {
562558
if (isNewProfile && !isConfirmed && errorCreating) {
563-
emailPlugin.deleteWholeProfile(email, function(err) {
564-
return emailPlugin.returnError(emailPlugin.errors.COULD_NOT_CREATE, response);
559+
emailPlugin.deleteWholeProfile(email, function() {
560+
return emailPlugin.returnError(err, response);
565561
});
566562
}
567563

0 commit comments

Comments
 (0)