You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The constructor calls an asyncronous function (but returns the new object -- the async is handled in the background and you lose your handle to it).
This is problematic, because I've got a boot up routine that instantiates a new LocalStorage, and then later (at some random future time) it'll report that it can't read the directory. But it's too late -- I never got a handle to that promise, so I can't capture the error. It just sits in the logs.
Instead, just make the constructor NOT call initialize. And make that the responsibility of the person who instantiated the class. That way I can capture the async result and hook up a .then to it.
(in my project I 'work around' this by calling initialize manually... so I'm basically just pretending the in-constructor call to initialize never happened, and doing it again so I can await it's result).
The text was updated successfully, but these errors were encountered:
node-storage/packages/core/src/LocalStorage.ts
Line 18 in f1754fe
The constructor calls an asyncronous function (but returns the new object -- the async is handled in the background and you lose your handle to it).
This is problematic, because I've got a boot up routine that instantiates a new LocalStorage, and then later (at some random future time) it'll report that it can't read the directory. But it's too late -- I never got a handle to that promise, so I can't capture the error. It just sits in the logs.
Instead, just make the constructor NOT call initialize. And make that the responsibility of the person who instantiated the class. That way I can capture the async result and hook up a .then to it.
(in my project I 'work around' this by calling initialize manually... so I'm basically just pretending the in-constructor call to initialize never happened, and doing it again so I can await it's result).
The text was updated successfully, but these errors were encountered: