Ok, we got you !
‘Wondering about the additional code, doesn’t it just redirect to the homepage if an error occurs?’ = yes, but we don’t know exactly when the issue starts so it requires some time to understand when it is and where. if you will have any ready results of testing/checking, write us and we will dig deeper inside the problem with provided details from your side.
Regards