Skip to content
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

simple throwing errors will not response the data i want #626

Open
yuchienho opened this issue Aug 4, 2014 · 1 comment
Open

simple throwing errors will not response the data i want #626

yuchienho opened this issue Aug 4, 2014 · 1 comment

Comments

@yuchienho
Copy link

the doc said that :"To return an error as your response, simply throw the error you want. "
then i do this:
if (err) {
throw new geddy.errors.BadRequestError();
}
i get follow:
Bad Request
at Steps.index (/Users/hyq/Brisker/Server/to_do/app/controllers/steps.js:9:17)
at utils.mixin.load (/Users/hyq/Brisker/Server/to_do/node_modules/geddy/node_modules/model/lib/adapters/mongo/index.js:310:13)
at Cursor.toArray (/Users/hyq/Brisker/Server/to_do/node_modules/mongodb/lib/mongodb/cursor.js:163:16)
at Cursor.nextObject.commandHandler (/Users/hyq/Brisker/Server/to_do/node_modules/mongodb/lib/mongodb/cursor.js:709:16)
at Db._executeQueryCommand (/Users/hyq/Brisker/Server/to_do/node_modules/mongodb/lib/mongodb/db.js:1847:9)
at Server.Base._callHandler (/Users/hyq/Brisker/Server/to_do/node_modules/mongodb/lib/mongodb/connection/base.js:445:41)
at Server.connect.connectionPool.on.server._serverState (/Users/hyq/Brisker/Server/to_do/node_modules/mongodb/lib/mongodb/connection/server.js:478:18)
at MongoReply.parseBody (/Users/hyq/Brisker/Server/to_do/node_modules/mongodb/lib/mongodb/responses/mongo_reply.js:68:5)
at Server.connect.connectionPool.on.server._serverState (/Users/hyq/Brisker/Server/to_do/node_modules/mongodb/lib/mongodb/connection/server.js:436:20)
at emit (events.js:95:17)

Process finished with exit code 8

The process exist in development mode while catching the uncaughtException in production mode.
How should i do to get the correct error response?

@ben-ng
Copy link

ben-ng commented Aug 4, 2014

Are you using bcrypt by any chance? Modules that use native bindings can result in this problem because the errors happen outside the domain.

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

2 participants