Disk error removing repositories

We had an issue with our gitea installation (1.12.1).
Our disk had an error and repositories health check failed:
Failed to health check repository…chdir /data/git/gitea-repositories/ … input/output error
Error in Cron: Delete old repository archives: input/output error
InitRepository [37]: mkdir /data/git: input/output error
It all ended up in all our repositories was removed from the database (but still existed on disk so we were able to restore some of our data)
It seems that a disk error will trigger an unfortunate delete process. Anyway of catching this issue? (Should be a try/catch in repo health check)