Rishikant181 / Rettiwt-API

A CLI tool and an API for fetching data from Twitter for free!
https://rishikant181.github.io/Rettiwt-API/
MIT License
305 stars 31 forks source link

Add ability to define custom error handling #418

Closed omarcinkonis closed 5 months ago

omarcinkonis commented 5 months ago

I tried to keep error handling as close as possible to the original logic, but I did make some changes:

Validation error is left unhandled (same as before). Further improvements could be made. It would be possible to return response on error without a fatal using IResponse errors

export interface IResponse<DataType> {
    data: DataType;
    errors?: IError[];
}

Everything is tested and confirmed to be working.

Please comment if you want me to make changes.

Rishikant181 commented 5 months ago

Everything is fine except there are some minor linting errors and some changes to variable names. I'll be fixing those in a separate branch and then merging with dev.

Thanks for the contribution!