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

Use reject on errors with indexeddb #84

Merged
merged 1 commit into from
Mar 3, 2014
Merged

Conversation

ocombe
Copy link
Contributor

@ocombe ocombe commented Feb 27, 2014

The indexeddb driver logs errors to the console but doesn't use reject, and there is no way to catch thoses because they are not thrown either...
It would help manage the bug #70

@coderaiser
Copy link

Good point, reject should be called. And there driver should be changed to websql and then (if no websql) to localStorage with this code:

localforage.setDriver(localforage.WEBSQL, console.log.bind(console))
localforage.setDriver(localforage.LOCALSTORAGEL, console.log.bind(console))

And then try to save data in store type that could work normally.

I don't thing that all this steps should be done on every library that use localForage. This things should be inside localForage.

@tofumatt
Copy link
Member

tofumatt commented Mar 3, 2014

@coderaiser localForage already tests for indexeddb and websql APIs and uses whatever it can find, so I don't see when your code would be needed.

I'd love some tests for this, but I will merge it in as-is for now. Though, in the future, if you make changes to the files in src/, please run make build afterward and commit the changes in dist/ so the changes get propagated to the built files. :-)

@tofumatt tofumatt merged commit dbe42c0 into localForage:master Mar 3, 2014
@coderaiser
Copy link

@tofumatt, I think that this would be needed in browsers that

private browsing in a few browsers (iOS Safari, Firefox) mode mucks with storage a fair bit

As you said in this issue.
Actually Firefox try to open database, shows error and that is all. He do not save any data at all.
When I use localForage, I do not thing that I should check is browser could use storage that he find. It's job of localForage by the way it's main purpose of it.

@ocombe
Copy link
Contributor Author

ocombe commented Mar 3, 2014

@tofumatt : ok for the make build, didn't know, but I'm working on Windows and I don't think it would work
@coderaiser : use the reject to make the switch to another driver (local storage for exemple), but I understand that it would not be DRY if you have to add this reject in all the getters setters if you don't know what will be called first
The automatic switch would have to be in the library initial test for indexeddb/websql with a detection for that kind of private browsing errors. Do you think it would be possible @tofumatt ?

@magalhas
Copy link
Contributor

magalhas commented Mar 3, 2014

Use Windows Powershell to execute the build script, it works. Though this will likely change in a near future :)

@ocombe ocombe deleted the patch-2 branch October 14, 2014 22:16
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

Successfully merging this pull request may close these issues.

None yet

4 participants