1
0
mirror of https://github.com/eleith/emailjs.git synced 2024-06-30 18:30:58 +00:00

test: use finally instead of then+catch

This commit is contained in:
Zack Schuster 2020-05-27 03:28:58 -07:00
parent c43189fd00
commit b76a198a93
3 changed files with 3 additions and 4 deletions

View File

@ -24,7 +24,7 @@ const send = (
done: () => void
) => {
server.onData = (stream: Readable, _session, callback: () => void) => {
mailparser.simpleParser(stream).then(verify).then(done).catch(done);
mailparser.simpleParser(stream).then(verify).finally(done);
stream.on('end', callback);
};
client.send(message, (err) => {

View File

@ -24,7 +24,7 @@ const send = (
done: () => void
) => {
server.onData = (stream: Readable, _session, callback: () => void) => {
mailparser.simpleParser(stream).then(verify).then(done).catch(done);
mailparser.simpleParser(stream).then(verify).finally(done);
stream.on('end', callback);
};
client.send(message, (err) => {

View File

@ -29,8 +29,7 @@ const send = (
mailparser
.simpleParser(stream, { skipTextLinks: true } as Record<string, unknown>)
.then(verify)
.then(done)
.catch(done);
.finally(done);
stream.on('end', callback);
};
client.send(message, (err) => {