-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing stack traces and some questions #21
Comments
I do call
That will not include the stack trace of the error object. I have to include it manually, like so:
The other points were more like ideas about some shorthands, if you will. But maybe they are unnecessary. However, the last point I think at least deserves a warning for the developer: If the expected arguments are |
Here is how I do it when catching manually (not using try {
throw new Error("oops in app client");
}
catch (e) {
const normalized = window.logger.tk.computeStackTrace(e);
window.logger.error(normalized.message, normalized);
} From my checks, it gives correct logging with a stack, like this:
Does this fail for you ? |
That works, however, wouldn't it be nice, if these two were equal?
|
Not sure what a consistent easy to use interface/signature could be. Do you have a suggestion of how it could be improved with a documentable spec (à la Jsdoc) ? At any rate, I think this question, and others before it, confirm doc needs to be rethought. Currently, it mostly enumerates the components, but I could probably be more useful as a set of examples, and moving the documented enumeration to the actual doc pages instead of the README, don't you think ? |
I think the doc could be improved with better structure by organizing content and providing more examples, instead of just being a long list of "random snippets of information" about the package. Also, regarding the last message about comparing the two ways of logging a manually caught errors, I think it would be nice not to force the developer to jump through hoops by calling
I think this is an excellent idea. Having a brief introduction and more tutorial-like-content in the README is preferable, in my opinion. |
As a sidenote, the README on npmjs appears blank: https://www.npmjs.com/package/filog |
About the README, yes I noticed that: I added "readme" clause in the package.json, as suggested by validation, but it is not described in the package.json spec and apparently contains the actual readme instead of the file name of the readme as expected: it will be reverted in the next release, but I don't think it warrants doing yet another release just for that. Agreed it would be nice to make things simpler, as you say, but what I have no idea about at this point is how to make it as simple as possible (but not simpler), so if you have a clear idea (hence the notion of how it could look as a jsdoc comment), I'm really interested. |
Well, if I understood correctly, here goes: Actually the second scenario in the first post ("Logging the error objects") is perfectly valid according to the current documentation for It says the message can be a Current JSDoc is here:
I would change it like this:
or maybe state in the
So in essence after the method logic complies to the specification, these two would have equal result:
|
Missing stack trace
If I catch an error on the client and attempt to log it like so:
Then, the entry in DB is missing the stack trace. The error object only consists of properties
line
,column
,sourceURL
.If I include the stack trace in the context manually like so:
-> Stack trace is present in the DB entry.
Is this intentional, if so, what is the reasoning behind it?
Logging the error objects
What about logging errors like so:
This produces an error log entry that's not helpful at all:
Is there a reason FiLog is not producing sensible output from this type of use?
Completely swallowing the error event
Should I try to log like this:
I get nothing logged, console or DB. It just silently does nothing. This is a bit dangerous, no?
The text was updated successfully, but these errors were encountered: