Skip to content

Conversation

@zombiezen
Copy link
Contributor

Instead of waiting for a nil return from fromContext to panic, I've
updated all callers to proactively return/panic with a common error
type. Panic is appropriate here, as it is a failed precondition of
values passed into the functions. It's not introducing any new panics,
just ones with more useful messages.

Addresses googleapis/google-cloud-go#523

Instead of waiting for a nil return from fromContext to panic, I've
updated all callers to proactively return/panic with a common error
type.  Panic is appropriate here, as it is a failed precondition of
values passed into the functions.  It's not introducing any new panics,
just ones with more useful messages.

Addresses googleapis/google-cloud-go#523
@zombiezen zombiezen requested a review from broady April 7, 2017 18:18
Copy link
Contributor

@broady broady left a comment

Choose a reason for hiding this comment

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

LGTM, just a couple nits

internal/api.go Outdated
if c == nil {
// Give a good error message rather than a panic lower down.
return errors.New("not an App Engine context")
return errNonAEContext
Copy link
Contributor

Choose a reason for hiding this comment

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

errNotAppEngineContext, maybe? Don't feel strongly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

}
}

var errNonAEContext = errors.New("not an App Engine context")
Copy link
Contributor

Choose a reason for hiding this comment

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

Move to top?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@zombiezen zombiezen merged commit eda0abe into master Apr 10, 2017
@broady broady deleted the panicctx branch April 10, 2017 17:18
@broady
Copy link
Contributor

broady commented Apr 10, 2017

How did these tests pass on Travis?

We even run goapp test.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants