ChrisVilches / sakura-dori

Frontend for viewing data scraped by Youtube Chat Logger. Message archive browser.
http://cloud.chrisvilches.com/sakura-dori/
0 stars 0 forks source link

Wrong transaction logic (maybe) #5

Open ChrisVilches opened 2 years ago

ChrisVilches commented 2 years ago

This code never fails as far as I know, but if it does, then the error handling logic wouldn't be correct.

https://github.com/ChrisVilches/sakura-dori/blob/main/src/services/IndexMessagesService.js

According to sequelize, you can throw an exception inside a transaction and that would rollback it automatically:

https://sequelize.org/master/manual/transactions.html#managed-transactions

But does that mean that Sequelize is swallowing the exception, which would mean that my try {} catch {} never catches the exception?

Or perhaps it's correct, considering that my code is the same as the one in the example. Read it carefully.

Expected outcome:

Handling logic is correct, when an error happens inside the indexing logic, it's thrown correctly and handled correctly. In case of error, an error status (using the enum) is returned.