Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Protect against an empty response #3037

Merged
merged 1 commit into from
Jun 14, 2017
Merged

Conversation

ianb
Copy link
Contributor

@ianb ianb commented Jun 14, 2017

This happened in some weird corner case while debugging

This happened in some weird corner case while debugging
} else if (result.type === "error") {
let exc = new Error(result.message);
} else if (result && result.type === "error") {
let exc = new Error(result.message || "Unknown error");
exc.name = "BackgroundError";
if ('errorCode' in result) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you'll need to guard against result being undefined in these "foo" in result clauses, too. They'll throw if result is falsy.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, we're inside a result && check here. Sorry!

Copy link
Member

@jaredhirsch jaredhirsch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, merging

@jaredhirsch jaredhirsch merged commit 14df39d into master Jun 14, 2017
@jaredhirsch jaredhirsch deleted the protect-callBackground branch June 14, 2017 20:06
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.

2 participants