Properly setting err.statusCode

Properly setting err.statusCode based on the status set in the raised error.  This should be the best practice going forward.