Refactor error handling methods. Now supports passing in a status code for session-less error handling