specific scenario: you need to write a piece of data to the database and upload an image at the same time. The name of the picture is the ID, to which the data is written. If the upload of the picture fails, do not write this data either.
solution: 1, if the picture fails to upload, delete the data (what if the deletion fails? I wrote it in the catch code of try {} catch {})
2, using database transaction processing, catch to error, and roll back
I think the second kind is a little safer. I don"t know how the gods usually deal with this problem.