Skip to content

Conversation

@besdar
Copy link

@besdar besdar commented Aug 28, 2024

Hello @s0ftik3!

I noticed that in the asynchronous methods of the Reverso class, you return objects instead of throwing an error. As a result, the returned promise is resolved with an object that indicates an error occurred. In the event of an error in your code, it is better to throw an instance of the Error class.

After my changes it would be possible to use catch method of the Promise class, for example:

reverso.getContext(
    'meet me half way',
    'english',
    'russian',
).then(result => doMyStuff(result)).catch(err => handleError(err))

ref: https://javascript.info/async-await

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant