Closed strixy closed 3 years ago
Ah, sorry for the confusion. The docs could be clearer about the example in regards to context. Yes, err
is undefined if you copy/paste the example as-is. The docs assume that the user would have already trapped an error in the err
variable, but it left that detail out for simplicity in the docs. We can update the docs to have better examples.
This brings up a good point with regards to logging errors, though. Error
objects do not serialize well due to some non-enumerable properties. This is basically the answer to the second part of your question. Since meta
ultimately calls JSON.stringify
before sending data over the wire, the error properties will be lost unless the user specifies them explicitly. We will update the docs to show how to effectively log a real Error
, and in the future, we can potentially add auto-detection for serializing Error
instance properties automatically.
If you use the example from the open PR, the logs will come out looking something like this:
:tada: This issue has been resolved in version 2.3.2 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
I understand why I am receiving this error and I'm happy to provide an explanation (and a PR) just in case anyone else happens to run into it (unlikely as that may be). This error, however, spawned another issue and I hope someone can help me sort that one out.
First issue is related to the example in the readme.md file under the heading Usage.
ReferenceError: err is not defined
I assumed
err
was a reference to the error in acatch(err)
block, for example, like so....So now the original error is gone, which is expected, but when I check the logs in the web interface, there's no stack. Example.
I'm not sure why?
I suppose the main question is, is it possible to send the stack along with the logger in some way?
Also, if this is the correct implementation of err in meta, do you accept PR's?