@@ -322,7 +322,8 @@ export default function InviteEmail() {
322 setStatus(STATUS.SENDING);
322 setStatus(STATUS.SENDING);
323 clearReceipts();
323 clearReceipts();
325− let errorCount = 0;
325+ let unsentInvites = [];
326+ let orphanedInvites = [];
326 const txAndMailings = inputs.map(async input => {
327 const txAndMailings = inputs.map(async input => {
327 const invite = invites[input.name];
328 const invite = invites[input.name];
@@ -337,10 +338,7 @@ export default function InviteEmail() {
337 if (!didConfirm) throw new Error();
338 if (!didConfirm) throw new Error();
338 } catch (error) {
339 } catch (error) {
339 console.error(error);
340 console.error(error);
340− errorCount++;
341+ unsentInvites.push(invite);
342− [input.name]: `Transaction Failure for ${invite.email}`,
@@ -354,11 +352,7 @@ export default function InviteEmail() {
354 if (!success) throw new Error('Failed to send mail');
352 if (!success) throw new Error('Failed to send mail');
355 } catch (error) {
353 } catch (error) {
356 console.error(error);
354 console.error(error);
357− errorCount++;
355+ orphanedInvites.push(invite);
358− //TODO make sure this actually gets displayed
360− [input.name]: `Mailing Failure for ${invite.email}, please send them this code manually: ${invite.ticket}`,
364 addReceipt({ [input.name]: true });
358 addReceipt({ [input.name]: true });
@@ -366,13 +360,24 @@ export default function InviteEmail() {
367 await Promise.all(txAndMailings);
361 await Promise.all(txAndMailings);
368 // if there are any receipt errors, throw a general error
362 // if there are any receipt errors, throw a general error
369− if (errorCount > 0) {
363+ let errorString = '';
364+ if (orphanedInvites.length > 0) {
366+ 'Not all invite emails were sent. ' +
367+ 'Please send the following invite codes manually: ' +
368+ orphanedInvites.map(i => `${i.email}: ${i.ticket}`).join(', ') +
371+ if (unsentInvites.length > 0) {
374+ 'Not all invites were created. ' +
375+ 'Did not send invites for: ' +
376+ unsentInvites.map(i => i.email).join(', ') +
379+ if (errorString !== '') {
370− throw new Error(
380+ throw new Error(errorString);
371− `There ${pluralize(errorCount, 'was', 'were')} ${pluralize(
374− )} while sending transactions.`
@@ -382,7 +387,6 @@ export default function InviteEmail() {
386 sendMail,
390 sendMail,