Answer the question
In order to leave comments, you need to log in
Why is an exception thrown when calling a method?
Good afternoon
The following method adds additional information for the user to the database upon registration
Accounts.onCreateUser(function(options, user) {
if(!options || !user) {
console.log('error creating user');
return;
} else {
if(options.profile) {user.profile = options.profile;}
user.rateELO=100;
user.rateCombine=1;
user.battleCount=0;
user.winPercent=0.00;
}
return user;
});
I20151109-14:51:36.022(3)? Exception from sub battles id 7L2jjjuZyai6Ko9h9 TypeError: Object [object Object] has no method 'user'
I20151109-14:51:36.023(3)? at [object Object].Accounts.onCreateUser.user.profile [as _handler] (server/Publish.js:25:1)
I20151109-14:51:36.023(3)? at maybeAuditArgumentChecks (livedata_server.js:1698:12)
I20151109-14:51:36.024(3)? at [object Object]._.extend._runHandler (livedata_server.js:1023:17)
I20151109-14:51:36.024(3)? at [object Object]._.extend._startSubscription (livedata_server.js:842:9)
I20151109-14:51:36.024(3)? at [object Object]._.extend.protocol_handlers.sub (livedata_server.js:614:12)
I20151109-14:51:36.024(3)? at livedata_server.js:548:43
I20151109-14:53:36.411(3)? Exception from sub battles id urKhdT94eF75a4ssC TypeError: Object [object Object] has no method 'user'
I20151109-14:53:36.411(3)? at [object Object].Accounts.onCreateUser.user.profile [as _handler] (server/Publish.js:25:1)
I20151109-14:53:36.411(3)? at maybeAuditArgumentChecks (livedata_server.js:1698:12)
I20151109-14:53:36.412(3)? at [object Object]._.extend._runHandler (livedata_server.js:1023:17)
I20151109-14:53:36.412(3)? at [object Object]._.extend._startSubscription (livedata_server.js:842:9)
I20151109-14:53:36.412(3)? at [object Object]._.extend.protocol_handlers.sub (livedata_server.js:614:12)
I20151109-14:53:36.412(3)? at livedata_server.js:548:43
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question