Skip to content

Very unhelpful error message.... #3425

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

Closed
acinader opened this issue Jan 24, 2017 · 1 comment
Closed

Very unhelpful error message.... #3425

acinader opened this issue Jan 24, 2017 · 1 comment

Comments

@acinader
Copy link
Contributor

So this one has been bugging me for awhile :). And I could use a little guidance on where to look for a good solution.

Sometimes, an error will result in a very unhelpful: [object Object] output on console.error.

So there's more than one problem here:

  1. Stuff should be output on console.error. Users of parse-server should expect that errors will be output to the logger, not the console.

  2. the error message is totally useless!

So I ran into this issue today and dug into it. I am part of the way there, but need some help to think through a better solution (or at least I need to put it on the back burner for now...)

I did determine where the output is coming from: the 'backstop' next() handler that is called at the end of an express request if 'something' isn't done to prevent it.

this calls this

In my case, the error was due to a misconfigured s3 adapter. And I fixed this particular error with this change: #3424

But I KNOW that there are other places where the dreaded [object Object] output to console.error occurs and it would be good if we could put in a good backstop.

SOOOOO, I see that middleware.js gets called and before handing off the arguments to the final backstop in express.

with a nice TODO: // TODO: Add logging as those errors won't make it to the PromiseRouter

it would seem to me that three changes are needed to make a general solution that will allow us to remove that todo:

  1. either extend Parse.Error (Parse.ServerError?) or add an optional param to Parse.Error so we can add the 'Source' with the source error that has caused the Parse.Error.

  2. log the source error in middlewares.handleParseErrors

  3. find all places where we new Parse.Error and add a source error if appropriate...

  4. remove the next() from the end of the middlewares.handleParseErrors.

I'm game to do it, but want to make sure I am on the right track since I'm no express expert...yet :).

PS, it would also seem reasonable to redefine console.log, console.warn, console.error to logger.info....etc.?

@acinader
Copy link
Contributor Author

acinader commented Jan 24, 2017

this is a dupe of #661

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant