Closed MasterOdin closed 12 months ago
I understood that it's misleading, from both viewpoints of documents and callback arguments.
My original intention was, users should specify callback
, and users can specify additional callbacks (success
and error
) for specific cases.
But specifying both success
and error
(without callback
) makes sense to me (and users, probably).
So, it looks good to me to add an argument check about the existence of opts.error
and opts.callback
, just like success
, and update README.
Right now, the code only requires that either
success
orcallback
be defined:https://github.com/tagomoris/presto-client-node/blob/42a7ca05220a8b6476c68dbecb1a510ed1be5139/lib/presto-client/index.js#L197-L198
However, if I define
success
and an error happens I get:The current documentation doesn't really make this clear that'll happen (to me), especially combined with #70 where
success
is documented to have anerror
as part of its callback signature.Would it make sense to have
error
also be required ifsuccess
callback is used andcallback
is not defined? Or perhaps just provide a no-op function when definingerror_callback
, e.g.error_callback = opts.error || opts.callback || () => {};
? Or just update README documentation?