mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-06-03 12:41:19 +00:00
The stack trace of thrown error objects is created when the object is instantiated - if we defer to a function to create the error we end up with misleading stack traces. This PR instantiates errors where errors occur and also uses the `err-code` module to add a `.code` property so we don't have to depend on string error messages for the type of error that was thrown.