l3wi / mam.client.js

Masked Authentication Messaging wrapper for Javascript (Browser and Node)
GNU General Public License v3.0
15 stars 51 forks source link

return the Error object while preventing throw to be called #5

Closed peterwilli closed 6 years ago

peterwilli commented 6 years ago

We recently tried to make our own full node for the municipality project and I got this error in my logs:

failed to attach message: 
 Error: Request Error: This operations cannot be executed: The subtangle has not been updated yet.

While obvious that the node still has to sync, it would be nice, if not required, for us to handle this error and show an appropriate message to the user (for whatever error that might be)

By returning the error object, we prevent that other projects using MAM will break (behavior stays the same), as code will still run even when the full node will return an error. The upside is that we now get returned an error object which one can handle should one desire to do so.

l3wi commented 6 years ago

Looks good!