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
catch failed setItem #3660
catch failed setItem #3660
Conversation
return new Promise(resolve => { | ||
return new Promise((resolve, reject) => { | ||
if (!this.win.localStorage) { | ||
reject('No localStorage object found'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure these two rejects are needed. If an error is thrown inside the resolver (and resolve has not been called yet), the promise rejects with that error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah these do get caught already its just the type of error
i wanted to clarify. (from logging pov). I probably won't merge this anyways and just filter them from our logs to a new metric
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed rejections
7f2e189
to
54e45cb
Compare
LGTM. |
@@ -135,6 +135,9 @@ export class Storage { | |||
const blob = btoa(JSON.stringify(store.obj)); | |||
return this.binding_.saveBlob(this.origin_, blob); | |||
}) | |||
.catch(reason => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's update on the binding level.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i believe this is obsolete.
54e45cb
to
b03bd5b
Compare
@dvoytenko PTAL. not sure if we still want to report localStorage support. |
@erwinmombay We still do want to report it. Our goal is to ensure it's not growing. If it would - that'd likely indicate a new client that has storage misconfigured. |
@@ -302,13 +305,21 @@ export class LocalStorageBinding { | |||
/** @override */ | |||
loadBlob(origin) { | |||
return new Promise(resolve => { | |||
if (!this.isLocalStorageSupported_) { | |||
resolve(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since loadBlob
is defined as a promise resolving null or string - let's do resolve(null);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
b03bd5b
to
425ff0b
Compare
LGTM pending test for |
425ff0b
to
ba269cc
Compare
No description provided.