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

Wrong footprint error message #30

Open
jaumard opened this issue Jan 19, 2016 · 6 comments
Open

Wrong footprint error message #30

jaumard opened this issue Jan 19, 2016 · 6 comments
Labels

Comments

@jaumard
Copy link
Contributor

jaumard commented Jan 19, 2016

If we call a route like /api/v1/default/toto, I have this error :

debug: [FootprintController] (find) model = default , criteria = {} info options =
Debug: internal, implementation, error 
    TypeError: Uncaught error: Cannot read property 'findOne' of undefined
    at FootprintService.find (/Users/jaumard/Downloads/testTrails/node_modules/trailpack-waterline/api/services/FootprintService.js:46:20)
    at FootprintController.find (/Users/jaumard/Downloads/testTrails/node_modules/trailpack-hapi/api/controllers/FootprintController.js:46:35)
    at result.method.finalize (/Users/jaumard/Downloads/testTrails/node_modules/hapi/lib/handler.js:215:20)
    at Object.exports.execute.internals.prerequisites.internals.handler.callback [as handler] (/Users/jaumard/Downloads/testTrails/node_modules/hapi/lib/handler.js:96:36)
    at /Users/jaumard/Downloads/testTrails/node_modules/hapi/lib/handler.js:63:26
    at done (/Users/jaumard/Downloads/testTrails/node_modules/hapi/node_modules/items/lib/index.js:31:25)
    at done (/Users/jaumard/Downloads/testTrails/node_modules/hapi/node_modules/items/lib/index.js:63:25)
    at /Users/jaumard/Downloads/testTrails/node_modules/hapi/lib/handler.js:49:28
    at finalize (/Users/jaumard/Downloads/testTrails/node_modules/hapi/lib/handler.js:281:20)
    at wrapped (/Users/jaumard/Downloads/testTrails/node_modules/hapi/node_modules/hoek/lib/index.js:867:20)
    at internals.Response._prepare.internals.Response._processPrepare.next [as _processPrepare] (/Users/jaumard/Downloads/testTrails/node_modules/hapi/lib/response.js:448:16)
    at internals.Response._prepare.next [as _prepare] (/Users/jaumard/Downloads/testTrails/node_modules/hapi/lib/response.js:387:21)
    at /Users/jaumard/Downloads/testTrails/node_modules/hapi/lib/reply.js:151:22
    at doNTCallback0 (node.js:408:9)
    at process._tickDomainCallback (node.js:378:13)

A better error message can be send like no model default or just 500 server error

@enten
Copy link

enten commented Feb 7, 2016

@context trailpack-waterline/api/Services/FootprintService

I guess that this error is due to an undefined reference when a model is recovered from app.orm or app.packs.waterline.orm.collections in FootprintService (line 38 for example).

All FootprintService methods can throws similar error (model not found).

Why there are no check to be sure if a model exists?

@weyj4
Copy link
Member

weyj4 commented Apr 19, 2016

@jaumard is this still an issue or can we close?

@jaumard
Copy link
Contributor Author

jaumard commented Apr 19, 2016

Still an issue but not for hapi I think because it have to be fix/check on trailpack-router or trailpack-footprints or each trailpack-datastore
Like @enten say there is no check to see if the model exist. Where we could put this issue ?

@jaumard
Copy link
Contributor Author

jaumard commented May 19, 2016

@weyj4 Here is how I fix this for Express and Sequelize
On Footprint service (sequelize) : https://github.com/trailsjs/trailpack-sequelize/blob/master/api/services/FootprintService.js#L27
On Footprint controller (express) : https://github.com/trailsjs/trailpack-express/blob/master/api/controllers/FootprintController.js#L25

With this Footprint controller web server doesn't send a 500 whatever the server is (as hapi do actually).

@mautematico
Copy link

Is there a way I can help with this?
I have particular interest on fixing the king of errors jaumard refers to on his last comment.
Related to this: trailsjs/trailpack-sequelize#23

@SrilakshmiGodugunuri7
Copy link

How to pass criteria = { column is not null} ?

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

No branches or pull requests

6 participants