Closed rvdkooy closed 7 years ago
Looks good, thanks!
What if the user hasn't subscribed to the error event? Shouldn't then the error be thrown (to be backwards compatible)?
Good catch!
my last commit should address this.
What do we return when a translation fails? I now return null
or should it be ""
of even undefined
?
R
Thanks, Ronald!
Hi Martin,
This PR adds the ability to listen for errors during translation.
since counterpart is depending on sprintf, which can throw, I think it is a good idea to wrap the sprintf call with a try/catch block.
This add the need to listen to these errors and handle this gracefully if needed.
see: https://github.com/alexei/sprintf.js/blob/master/src/sprintf.js#L45 https://github.com/alexei/sprintf.js/blob/master/src/sprintf.js#L62 https://github.com/alexei/sprintf.js/blob/master/src/sprintf.js#L62 ... and more
What do you think?
R