coolaj86 / json-storage-js

A wrapper for storage engines which use the W3C Storage API
12 stars 0 forks source link

Return false if invalid argument #4

Closed ryanburnette closed 10 years ago

ryanburnette commented 10 years ago

It might be more intuitive if you get a return of false or an error object if you try to create on something that isn't a valid storage object.

I had a typo in my code and it took me a while to track it down because I didn't get an error I expected.

var foo = JsonStorage.create("localStorage");

Silly me. I had quotes around localStorage. I fixed the problem but it took me a bit to track it down. If an error was raised I'd have known faster.

coolaj86 commented 10 years ago

I decided to throw an exception since there's no way you can use the library without having a valid DOM Storage API thingy.

Fixed in 9cdcdf98d9d73d60907eaa94afe20ee81e159014