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

Error in getting item #39

Closed
lovestoprogram opened this issue Sep 14, 2016 · 4 comments
Closed

Error in getting item #39

lovestoprogram opened this issue Sep 14, 2016 · 4 comments

Comments

@lovestoprogram
Copy link

So after trying to use get item I get this error

Error in Success callbackId: NativeStorage742808021 : TypeError: error is not a function on line 312 of cordova.js

and Uncaught TypeError: error is not a function on line 314 of cordova.js

Then if I use getItem again, it returns error code 5 and also has the same error on line 312 and 314 of cordova js.

Thank you for your time.

@lovestoprogram
Copy link
Author

Never mind. It was completely my fault and the issue is solved.

@alokrajiv
Copy link
Collaborator

Thank you.

@GillesC
Copy link
Collaborator

GillesC commented Sep 14, 2016

Hello,
Can you maybe post what was wrong and how you solved it? This for future
reference, for developers having the same problem?

On Wed, 14 Sep 2016, 06:45 Alok Rajiv, notifications@github.com wrote:

Thank you.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#39 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AIOhi5P6A80A2mArzt5vMfoYrEtezWBWks5qp3vSgaJpZM4J8VUb
.

@lovestoprogram
Copy link
Author

Sure. Well I called a this.doSomethingFunction() inside the success callback for setting an item, and the value of this wasn't the object I meant it to be (I forgot about the rules of "this"), so it threw an error.
The interesting thing is that when I tried to get the data it triggered the error call 5. I changed this.doSomethingFunction() to nameOfObjectThatMethodBelongsTo.doSomethingFunction() and it worked fine.

I also ran through an issue where the function that I tried to call in the success callback of setItem had a type error in it, and trying to access the value again I think triggered an error 5(I am not completely sure about this case, but it is likely). I fixed the type error, and it worked fine. Reading the .exception error helped in both cases to find the cause of the error.

All in all, if someone calls a method from another object in a success callback and a weird error occurs, see the source code for that function and use .exception to see what the error is and what caused it.

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

No branches or pull requests

3 participants