TypeError: String includes not contains, #53; only first line of error

This commit is contained in:
Ralf Vogler 2023-01-29 19:28:02 +01:00
parent d7e5cc4a3a
commit c5b0065a50
3 changed files with 6 additions and 6 deletions

4
gog.js
View file

@ -122,8 +122,8 @@ try {
}
} catch (error) {
console.error(error); // .toString()?
if (!error.message.contains('Target closed')) // e.g. when killed by Ctrl-C
notify(`prime-gaming failed: ${error.message}`);
if (error.message && !error.message.includes('Target closed')) // e.g. when killed by Ctrl-C
notify(`gog failed: ${error.message.split('\n')[0]}`);
} finally {
await db.write(); // write out json db
if (notify_games.filter(g => g.status != 'existed').length) { // don't notify if all were already claimed; TODO don't notify if killed?