Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.

Check if error message exists before using it in Pane.handleSaveError - #7717

Merged
kevinsawicki merged 1 commit into
masterfrom
iz-pane-handle-save-error
Jul 7, 2015
Merged

kevinsawicki merged 1 commit into
masterfrom
iz-pane-handle-save-error

Conversation

@izuzak

@izuzak izuzak commented Jul 5, 2015

Copy link
Copy Markdown
Contributor

This should fix #7714, though I'm not really sure when an error won't have a message defined (other than manually setting it to undefined, which a package could do I guess?).

cc @kevinsawicki for 💭 👀

@kevinsawicki

Copy link
Copy Markdown
Contributor

I think it would be empty in weird cases like this perhaps?

try { throw 'test' } catch(e) { console.log(e, e.message) }

kevinsawicki added a commit that referenced this pull request Jul 7, 2015
Check if error message exists before using it in Pane.handleSaveError
@kevinsawicki
kevinsawicki merged commit b852b06 into master Jul 7, 2015
@kevinsawicki

Copy link
Copy Markdown
Contributor

💙

@kevinsawicki
kevinsawicki deleted the iz-pane-handle-save-error branch July 7, 2015 17:14
@izuzak

izuzak commented Jul 7, 2015

Copy link
Copy Markdown
Contributor Author

I think it would be empty in weird cases like this perhaps?
try { throw 'test' } catch(e) { console.log(e, e.message) }

Ahhh, thanks for that snippet! 👍 I was trying to trigger it with just the Error class somehow and couldn't get it to have a non-string message. Thanks again!

@kevinsawicki

Copy link
Copy Markdown
Contributor

Just thinking about this a bit more, to be extremely safe, endsWith should probably be guarded against as well for this case:

try { throw {message: 10} } catch(e) { console.log(e, e.message) }

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Uncaught TypeError: Cannot read property 'endsWith' of undefined, using Jekyll

3 participants