Javascript Throw Error With Status Code