Skip to content
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

Rethrow functions esbuild errors #5231

Open
wants to merge 1 commit into
base: 01-17-don_t_start_the_dev_session_if_there_are_build_errors
Choose a base branch
from

Conversation

isaacroldan
Copy link
Contributor

@isaacroldan isaacroldan commented Jan 17, 2025

WHY are these changes introduced?

We want ESBuild errors from functions to appear in the dev logs.

WHAT is this pull request doing?

If a javascript function throws an ESBuild error, re-throw as it is and the dev-session will automatically parse and format it.

How to test your changes?

  1. Create a javascript function extension
  2. Run dev
  3. Modify the function to have some syntax error.
  4. See that the error is properly shown in the dev log, with specific details on where it happened.

Measuring impact

  • n/a - this doesn't need measurement, e.g. a linting rule or a bug-fix

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes

Copy link
Contributor Author

isaacroldan commented Jan 17, 2025

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link
Contributor

github-actions bot commented Jan 17, 2025

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
75.19% (-0% 🔻)
8893/11828
🟡 Branches
70.42% (+0% 🔼)
4336/6157
🟡 Functions 75.01% 2335/3113
🟡 Lines
75.75% (+0% 🔼)
8404/11094

Test suite run success

2004 tests passing in 905 suites.

Report generated by 🧪jest coverage report action from a1b5698

@isaacroldan isaacroldan marked this pull request as ready for review January 17, 2025 16:40
@isaacroldan isaacroldan requested a review from a team as a code owner January 17, 2025 16:40
Copy link
Contributor

We detected some changes at packages/*/src and there are no updates in the .changeset.
If the changes are user-facing, run "pnpm changeset add" to track your changes and include them in the next release CHANGELOG.

@isaacroldan isaacroldan force-pushed the 01-17-rethrow_functions_esbuild_errors branch from 23d656e to a1b5698 Compare January 17, 2025 17:15
Comment on lines +191 to +193
const errors = error.errors ?? []
// If there is an `errors` array, it's an esbuild error, re-throw it directly.
if (errors.length) throw error
Copy link
Contributor

Choose a reason for hiding this comment

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

since we never use errors again

Suggested change
const errors = error.errors ?? []
// If there is an `errors` array, it's an esbuild error, re-throw it directly.
if (errors.length) throw error
// If there is an `errors` array, it's an esbuild error, re-throw it directly.
if (error.errors?.length) throw error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants