-
Notifications
You must be signed in to change notification settings - Fork 427
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve Stimulus Values type mismatch error messages (#528)
* Make types messages much more friendly * Fix some errors messages * Add controller name to types mismatch errors * Print controller in type mismatch error when it possible * Remove redundant controller presence check Since the `propertyPath` already has the conditional in it it's basically the same logic twice. With that we can just reduce it to the second `throw`. * Reword value type error message * Improve error message for setting/overriding Stimulus Values Before: - "TypeError: Expected object" - "TypeError: Expected array" After: - TypeError: Stimulus Value "my-controller.myObjectValue" - expected value of type "object" but instead got value "false" of type "boolean" - TypeError: Stimulus Value "my-controller.myArrayValue" - expected value of type "array" but instead got value "123" of type "number" Co-authored-by: Marco Roth <[email protected]>
- Loading branch information
Showing
2 changed files
with
51 additions
and
31 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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