Any ideas what might cause an undefined getChannel it only happens once every couple users. Shouldn't the getChannel always work if the user is online?
2006/01/17 17:28:35.163 - [ WARNING ] [id: 11] (JavascriptExtension.logASError): Error in extension [ server.as ]: TypeError: Cannot call method "getChannel" of undefined (server.as#401) Line: -514 (MainLib line: 401)
Thanks
rsnail
undefined getChannel
Just from the error is not very easy to tell.
The code from the mainlib.as is this:
It basically just loops through the userList array and calls the getChannel() method.
The error could be thrown because some other object was erroneously added to the list or because the User has been disconnected and its not available anymore.
Question: did you by chance add new methods to the array prototype?
Like:
This could be a reason too...
The code from the mainlib.as is this:
Code: Select all
else if (userList.length > 0 && response != undefined)
{
var list = new java.util.LinkedList()
for (var i in userList)
{
list.add(userList[i].getChannel())
}
__extension.sendResponse(result, fromRoom, u, list)
}
It basically just loops through the userList array and calls the getChannel() method.
The error could be thrown because some other object was erroneously added to the list or because the User has been disconnected and its not available anymore.
Question: did you by chance add new methods to the array prototype?
Like:
Code: Select all
Array.prototype.myMethod = function()
{
// whatever ...
}
This could be a reason too...
One more thing. If you want to debug what's going on from inside the mainlib.as you could modify the code starting from line 395 like this:
Code: Select all
else if (userList.length > 0 && response != undefined)
{
var list = new java.util.LinkedList()
for (var i in userList)
{
var u = userList[i]
if (u.getChannel == undefined)
trace("found non-User object at " + i + " type: " + typeof u)
else
list.add(u.getChannel())
}
__extension.sendResponse(result, fromRoom, u, list)
}
Hello,
Nope, I did not add new methods to the array prototype.
I am using the getUserByChannel() after the loginUser() in an extension, so I can notify the user what their id is, and set a couple user.properties.
Most logins do not show this error, only 1 out of a 100.
I'll add a couple more logging messages to the mainLib.as to track down if it is the same user, or if the user lost connection during login.
Nope, I did not add new methods to the array prototype.
I am using the getUserByChannel() after the loginUser() in an extension, so I can notify the user what their id is, and set a couple user.properties.
Most logins do not show this error, only 1 out of a 100.
I'll add a couple more logging messages to the mainLib.as to track down if it is the same user, or if the user lost connection during login.
Return to “Server Side Extension Development”
Who is online
Users browsing this forum: No registered users and 32 guests