Handle error 500 and show a message instead of crashing