strongloop / loopback-example-access-control

An example demonstrating LoopBack access control mechanisms.
Other
370 stars 168 forks source link

server shutdown when I try to login as non Guest (jane , jhon or bob ) #43

Closed todototry closed 9 years ago

todototry commented 9 years ago

bug trace as follow:

  token = token.toJSON();
                ^

TypeError: Cannot call method 'toJSON' of undefined at C:\nodejsProjects\loopback-example-access-control\server\boot\routes.js:2 1:21 at C:\nodejsProjects\loopback-example-access-control\node_modules\loopback\c ommon\models\user.js:219:9 at C:\nodejsProjects\loopback-example-access-control\node_modules\loopback-d atasource-juggler\lib\dao.js:858:62 at C:\nodejsProjects\loopback-example-access-control\node_modules\loopback-d atasource-juggler\lib\dao.js:834:7 at C:\nodejsProjects\loopback-example-access-control\node_modules\loopback-d atasource-juggler\lib\connectors\memory.js:345:7 at C:\nodejsProjects\loopback-example-access-control\node_modules\loopback\n ode_modules\continuation-local-storage\node_modules\async-listener\glue.js:188:3 1 at C:\nodejsProjects\loopback-example-access-control\node_modules\loopback\n ode_modules\continuation-local-storage\node_modules\async-listener\glue.js:188:3 1 at process._tickDomainCallback (node.js:486:13) at process. (C:\nodejsProjects\loopback-example-access-control\no de_modules\loopback\node_modules\continuation-local-storage\node_modules\async-l istener\index.js:18:15)

superkhau commented 9 years ago

Can you try again with the new repo updates? Closing for now, reply if you run into any new issues.

todototry commented 9 years ago

it seems working pretty well now. but is there any elegant way to keep the node server running instead of shutting down when exceptions occurred ? it's really ugly and crippled to keep trying restart.

superkhau commented 9 years ago

In your production app, you will have to handle your own exceptions via your typical try/catch or handing the error value returned in the callback accordingly. If you can describe a particular scenario, I can show you how to manage that case specifically.