Ticket #2230 (closed enhancement: wontfix)
If Dojo Storage not initialized, but storage methods called, throw exception
| Reported by: | bradneuberg | Owned by: | bradneuberg |
|---|---|---|---|
| Priority: | high | Milestone: | 1.4 |
| Component: | Storage/Flash | Version: | 0.4.1 |
| Severity: | normal | Keywords: | |
| Cc: |
Description (last modified by BradNeuberg) (diff)
Right now a common source of problems is this: folks start calling the Dojo Storage put(), get(), etc. methods BEFORE Dojo Storage is initialized. I want to add some defensive programming techniques here to help external users of the API so they get a better error message. If someone calls one of these methods, AND they have not added a Dojo Storage "loaded" event listener, throw an exception and print a message that they must add an event listener, also pointing them to the Dojo Storage Book page URL.
This will eliminate a common bug when working with Dojo Storage, which is that folks get strange Dojo Flash messages if they never added a Dojo Storage "loaded" event listener. This will help them see what is going on quicker and change their code.