Api Error Handling In Typescript