First functionality for creating errors with status codes