Skip to content
This repository has been archived by the owner on Aug 3, 2023. It is now read-only.

Improve JSON errors debuggability #394

Merged
merged 2 commits into from
Aug 5, 2019
Merged

Improve JSON errors debuggability #394

merged 2 commits into from
Aug 5, 2019

Conversation

xtuc
Copy link
Member

@xtuc xtuc commented Aug 5, 2019

feat: improve JSON errors debuggability

As seen in #393 previously
JSON decoding errors are obscure.

This changes improve the debugging in three cases:

  • The package.json file fails to decode; now emits a clearer error.
  • The wranglerjs backend returns an invalid JSON; now preserves the
    output file for further investigation.
    The console doesn't print the output file location by default, you
    need to pass RUST_LOG=info while running wrangler build and
    search for --output-file=FILE argument passed to wranglerjs.
  • The preview service returns invalid JSON; now emits a clearer error
    and full output can be seen using RUST_LOG=info

@xtuc xtuc added changelog - feature webpack Issues that involve the `webpack` bundler and removed webpack Issues that involve the `webpack` bundler labels Aug 5, 2019
message::success(&msg);
Ok(())
} else {
fs::remove_file(temp_file)?;
Copy link
Contributor

Choose a reason for hiding this comment

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

if we are preserving this for forensic purposes, should we output its location?

Copy link
Member Author

@xtuc xtuc Aug 5, 2019

Choose a reason for hiding this comment

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

I assume that "forensic purposes" is similar to post mortem analysis, in that case yes. The location is available when using RUST_LOG=info. The user doesn't need to know about its exisiance.

As seen in #393 previously
JSON decoding errors are obscure.

This changes improve the debugging in three cases:
  - The `package.json` file fails to decode; now emits a clearer error.
  - The wranglerjs backend returns an invalid JSON; now preserves the
  output file for further investigation.
    The console doesn't print the output file location by default, you
    need to pass `RUST_LOG=info` while running `wrangler build` and
    search for `--output-file=FILE` argument passed to wranglerjs.
  - The preview service returns invalid JSON; now emits a clearer error
    and full output can be seen using `RUST_LOG=info`
@ashleygwilliams ashleygwilliams added this to the 1.1.1 milestone Aug 5, 2019
Copy link
Contributor

@EverlastingBugstopper EverlastingBugstopper left a comment

Choose a reason for hiding this comment

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

lgtm

@xtuc xtuc requested a review from ashleymichal August 5, 2019 15:52
@xtuc xtuc merged commit 601e7bf into master Aug 5, 2019
@delete-merged-branch delete-merged-branch bot deleted the sven/improve-json-errors branch August 5, 2019 16:03
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants