Catch errors when failing to write logs to database