-
Notifications
You must be signed in to change notification settings - Fork 201
[Scripts] Handle Configuration Definition Error #1919
Conversation
3142219
to
0ffdeec
Compare
It's a shame that we can't do much with the format of that string. Even just being able to add the word value or field I think would help. myString field: value must be an integer. When you say that this error comes from the server -- is this server under our or metafield's control at all? |
The part before the colon is something we do in |
0ffdeec
to
e8237a2
Compare
@@ -47,41 +47,38 @@ module Messages | |||
invalid_language_cause: "Invalid language %s.", | |||
invalid_language_help: "Allowed values: %s.", | |||
|
|||
missing_script_config_yml_field_cause: "The script.config.yml file is missing the required %s field.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MeredithCastile there have been some content changes here. It'd be great to get your thoughts on those.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the exception of the added messages (configuration_error_cause
and configuration_error_help
), all of the messages should be the same, just with placeholders for the file name during this grace period when we support both script.config.yml
and script.json
, and to make it easier to change the filename in the future (not hard-coded in a bunch of strings).
Thanks for this context Adam. |
Ideally:
Would something like this work? Then for the |
This sounds reasonable! |
ae8987e
to
50c68f9
Compare
50c68f9
to
b2e8694
Compare
WHY are these changes introduced?
Closes https://github.com/Shopify/script-service/issues/4086
We want to handle the
configuration_definition_error
error tag on theappScriptSet
mutation withscript-service
.WHAT is this pull request doing?
The first commit of this PR adds handling of the case when the error tag on the
appScriptSet
mutation isconfiguration_definition_error
so that we can display a nice error message that is actually helpful.This is what it looks like. Note that
Error at
myString: must be an integer.
comes entirely from the server so if we don't like the structure of that sentence it is not a change that can be made in this PR. @kwringe WDYT?The second commit of this PR refactors a bunch of configuration-related errors to have a generic filename so that they actually display the correct filename (this was an oversight of mine in #1826). I realize that we will soon be getting rid of much of the V1 configuration and corresponding errors, as well as
script.json
, but nonetheless I believe it is good to have this be generic so that in the future it is easier to change the name of the configuration file, should we need that.If you think I should do this in two separate PRs, just let me know and I will break it up.
How to test your changes?
There are many ways to see the V2 configuration error on push. One such way would be with the following
script.config.yml
:To 🎩 the refactor of the existing configuration errors, there are a number of things you can do:
script.json
script.config.yml
type
invalid (notlist
orsingle
)type
schema
as an object instead of arraytype
(notsingle_line_text_field
)type
Update checklist