You aren't processing `err`. Do that first and return a 500.