Forum PayVault Error: Cannot access coins before vault has been loaded

Discussion and help relating to the PlayerIO payment solution, PayVault.

Error: Cannot access coins before vault has been loaded

Postby robscherer123 » May 20th, 2013, 8:47 pm

I'm getting this error in my error log "Error. In callback handler for PayVault.payVaultRefresh". Whenever I click it for more details it says "Cannot access coins before vault has been loaded. Please refresh the vault first". Maybe I'm crazy, but I'm pretty sure I only call theClient.payVault.coins inside of the refresh function. Is there an easy explanation as to why this I am getting this error? I don't get it all the time, it only appears in my error log here and there.
robscherer123
Paid Member
 
Posts: 313
Joined: December 12th, 2012, 8:46 pm

Re: Error: Cannot access coins before vault has been loaded

Postby robscherer123 » May 22nd, 2013, 3:49 pm

I've got more details on the error. Here is the stack trace along with the connecting traces.

Code: Select all
Sucessfully connected to player.io
Error: Cannot access coins before vault has been loaded. Please refresh the vault first
   at bridge::PayVault/get coins()
   at MethodInfo-1032()
   at <anonymous>()
   at <anonymous>()
   at <anonymous>()
   at flash.events::EventDispatcher/dispatchEventFunction()
   at flash.events::EventDispatcher/dispatchEvent()
   at flash.net::URLLoader/onComplete()
Sucessfully connected to the multiplayer server
new player just joined the room


So this means it's happening after the PlayerIO connect function but before the join room handler. I'm led to believe this is not something on my end. Can someone confirm this so I'm not waisting time trying to hunt down the error? I'm trying to trim down my error log.
robscherer123
Paid Member
 
Posts: 313
Joined: December 12th, 2012, 8:46 pm

Re: Error: Cannot access coins before vault has been loaded

Postby Henrik » May 22nd, 2013, 4:16 pm

A good first step is to find the code that actually causes this error message to be printed.
Henrik
.IO
 
Posts: 1880
Joined: January 4th, 2010, 1:53 pm

Re: Error: Cannot access coins before vault has been loaded

Postby robscherer123 » May 22nd, 2013, 4:36 pm

The only time I call payVault.coins is inside the refresh function. So it looks like this.


Code: Select all
theClient.payVault.refresh(function():void {
   tickets = theClient.payVault.coins;
});



Is something wrong with that setup or is the problem likely to be somewhere else? It works 95% of the time.
robscherer123
Paid Member
 
Posts: 313
Joined: December 12th, 2012, 8:46 pm

Re: Error: Cannot access coins before vault has been loaded

Postby dreamora » May 23rd, 2013, 12:23 am

where is this function called?
dreamora
 
Posts: 225
Joined: March 2nd, 2012, 9:58 am

Re: Error: Cannot access coins before vault has been loaded

Postby Benjaminsen » May 23rd, 2013, 1:04 pm

dreamora wrote:where is this function called?


Anywhere after you have successfully authenticated.
Benjaminsen
.IO
 
Posts: 1444
Joined: January 12th, 2010, 11:54 am
Location: Denmark

Re: Error: Cannot access coins before vault has been loaded

Postby robscherer123 » June 4th, 2013, 2:41 pm

It is loaded after a player logs in and whenever a player clicks to view the payvault. Not sure why it's coming up though, there's not much to it. =/
robscherer123
Paid Member
 
Posts: 313
Joined: December 12th, 2012, 8:46 pm

Re: Error: Cannot access coins before vault has been loaded

Postby robscherer123 » June 4th, 2013, 3:55 pm

Ok, so the error happened to occur while I was in debug mode again. This time I tracked it through the variable list and this is what i found. If you take a look at the variables list on the left it says "<exception thrown by getter>" in gray next to the coins and items variables for client.payvault. Under normal operation this would show the users coins and also return an array of items for the items variable. So I guess this would mean this isn't a problem on my end.

Is there some kind of simple check I can put in place to make this error not get thrown? Something like "if(coins != null)" or something like that?

Full size image: http://oi40.tinypic.com/25tdcmo.jpg

Resized image:
Image
robscherer123
Paid Member
 
Posts: 313
Joined: December 12th, 2012, 8:46 pm

Re: Error: Cannot access coins before vault has been loaded

Postby Henrik » June 4th, 2013, 4:52 pm

robscherer123 wrote:Ok, so the error happened to occur while I was in debug mode again. This time I tracked it through the variable list and this is what i found. If you take a look at the variables list on the left it says "<exception thrown by getter>"

Yes, if you evaluate a variable in debug mode, the getter is called, and if that user's vault isn't refreshed, it will throw that exception.
Henrik
.IO
 
Posts: 1880
Joined: January 4th, 2010, 1:53 pm

Re: Error: Cannot access coins before vault has been loaded

Postby robscherer123 » June 4th, 2013, 5:01 pm

Hmm... But how is the user's vault not being refreshed? I call the coins function directly inside of the refresh function like the documentation says to do. Wouldn't that mean it should be impossible for it to not be refreshed? You can see on the line number in the debug report what line it occurs on too.
robscherer123
Paid Member
 
Posts: 313
Joined: December 12th, 2012, 8:46 pm

Re: Error: Cannot access coins before vault has been loaded

Postby Henrik » June 4th, 2013, 5:28 pm

Yes, but at what point are you checking the variable while in debug mode? After the refresh callback has been called, or before it?
Henrik
.IO
 
Posts: 1880
Joined: January 4th, 2010, 1:53 pm

Re: Error: Cannot access coins before vault has been loaded

Postby robscherer123 » June 4th, 2013, 6:08 pm

The debug data I showed above was called after the refresh function is fired back. Line 4722 showed in the picture is the line that the debugger pauses on from the "theClient.payVault.coins" being called because of the error. Like I said though, about 96% of the time I get no error, it's just every now and then. If I add a break point on that same line (line 4722, the line where coins is called), the debug data for "coins" and "items" shows up. It just that rare occasion that it doesn't.
robscherer123
Paid Member
 
Posts: 313
Joined: December 12th, 2012, 8:46 pm


Return to PayVault



cron