-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Themes] theme dev
- unify asset upload error reporting
#5209
base: main
Are you sure you want to change the base?
Conversation
Coverage report
Show files with reduced coverage 🔻
Test suite run success2007 tests passing in 906 suites. Report generated by 🧪jest coverage report action from 454ca51 |
1447d8a
to
5ac4ebb
Compare
5ac4ebb
to
3c10c59
Compare
theme dev
- unify asset upload error reporting
9cf51e3
to
7446211
Compare
This comment has been minimized.
This comment has been minimized.
7446211
to
f997b11
Compare
f997b11
to
2bdf2fb
Compare
outputWarn(`Failed to upload file ${key}:`) | ||
outputInfo(`${errorMessage}`) | ||
outputNewline() | ||
const errorMessage = result.errors?.asset?.map((err) => `-${err}`).join('\n') ?? 'File upload failed' |
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.
Since we're in here modifying this code... could we render all of the failed uploads in a single error? Something that looks like:
╭─ failure ────────────────────────────────────────────────────────────────────╮
│ │
│ Failed to upload files: │
│ │
│ • snippets/foo.liquid
| Some reason for the error │
│ │
│ • snippets/foo.liquid
| Some reason for the error │
│ │
│ • snippets/foo.liquid
| Some reason for the error │
│ │
╰──────────────────────────────────────────────────────────────────────────────╯
What do you think?
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.
Yes, though I would prefer to do that outside of this issue since I have am making this quick change to build on top of it.
I am also adding an uploadErrors
map on top of this that will enable us to go in the direction you're suggesting!
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.
I don't think we need uploadErrors
for this since we already have the results in uploadResults
here but I'm happy enough to push my suggestion off into a follow up.
outputWarn(`Failed to upload file ${key}:`) | ||
outputInfo(`${errorMessage}`) | ||
outputNewline() | ||
const errorMessage = result.errors?.asset?.map((err) => `-${err}`).join('\n') ?? 'File upload failed' |
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.
I don't think we need uploadErrors
for this since we already have the results in uploadResults
here but I'm happy enough to push my suggestion off into a follow up.
Co-authored-by: Gray Gilmore <graygilmore@gmail.com>
bdd01e4
to
4d5dfae
Compare
Co-authored-by: Fran Dios <fran.dios@shopify.com>
WHY are these changes introduced?
Improves consistency of how we surface asset upload errors to the user
The
theme dev
command uploads in two placesThe way we report these errors were different, leading to a disjointed visual experience
This PR unifies the way those errors are rendered to the terminal.
This also makes it easier for us to revisit whether we want to render this, or just call
outputWarn
. Personally, I feel like this adds noise to the terminal but I wanted to keep this change insulated for the moment. Consistency is more important in the short term.WHAT is this pull request doing?
BEFORE
AFTER
How to test your changes?
theme dev
commandPost-release steps
Measuring impact
How do we know this change was effective? Please choose one:
Checklist