Clearer error message#349
Merged
Merged
Conversation
|
Hey @galencorey, Thanks for the PR! Mind signing our Contributor License Agreement? When you've done so, go ahead and comment Yours truly, |
Contributor
Author
|
[clabot:check] |
|
CLA signature looks good 👍 |
k4b7
suggested changes
Apr 4, 2019
Contributor
k4b7
left a comment
There was a problem hiding this comment.
The change and the test looks good. The style changes to the test file are unrelated though. Please revert them.
| }; | ||
|
|
||
| const isValidStyleDefinition = (def /* : Object */) => | ||
| "_definition" in def && "_name" in def && "_len" in def; |
Contributor
There was a problem hiding this comment.
I was hoping to make something like this public for #306.
| definitionBits.push(styleDefinitions[i]._definition); | ||
| length += styleDefinitions[i]._len; | ||
| } else { | ||
| throw new Error("Invalid Style Definition: Styles should be defined using the StyleSheet.create method.") |
|
|
||
| it("throws a useful error for invalid arguments", () => { | ||
| assert.throws(() => css({ color: "red" }), "Invalid Style Definition"); | ||
| }); |
bceb252 to
7248751
Compare
Contributor
Author
|
@kevinbarabash thank you for your review! reverted all the linter changes. Prettier has no chill sometimes. |
k4b7
approved these changes
Apr 6, 2019
Contributor
k4b7
left a comment
There was a problem hiding this comment.
LGTM. Thanks for reverting the style changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes #265
Add a more explicit error message when someone tries to pass a plain object instead of a stylesheet into the
css()method.Note: My editor went crazy with the double quotes. Let me know if you would like me to switch them back!