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

feat(trace): pretty print trace errors to logs #9367

Merged
merged 6 commits into from
Nov 5, 2024

Conversation

NicholasLYang
Copy link
Contributor

Description

To help debug trace, pretty print the errors to stderr by default. Includes fancy error messages either via SWC or our own miette infrastructure

Testing Instructions

Try using trace and hit an error

Copy link

vercel bot commented Nov 1, 2024

Deployment failed with the following error:

Too many requests - try again in 2 seconds (more than 300, code: "api-deployments-flood-enterprise").

Copy link

vercel bot commented Nov 1, 2024

Deployment failed with the following error:

Too many requests - try again in 4 seconds (more than 300, code: "api-deployments-flood-enterprise").

Copy link

vercel bot commented Nov 1, 2024

Deployment failed with the following error:

Too many requests - try again in 296 ms (more than 300, code: "api-deployments-flood-enterprise").

Copy link

vercel bot commented Nov 1, 2024

Deployment failed with the following error:

Creating the Deployment Timed Out.

Copy link

vercel bot commented Nov 1, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
examples-nonmonorepo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 5, 2024 4:24pm
8 Skipped Deployments
Name Status Preview Comments Updated (UTC)
examples-basic-web ⬜️ Ignored (Inspect) Visit Preview Nov 5, 2024 4:24pm
examples-designsystem-docs ⬜️ Ignored (Inspect) Visit Preview Nov 5, 2024 4:24pm
examples-gatsby-web ⬜️ Ignored (Inspect) Visit Preview Nov 5, 2024 4:24pm
examples-kitchensink-blog ⬜️ Ignored (Inspect) Visit Preview Nov 5, 2024 4:24pm
examples-native-web ⬜️ Ignored (Inspect) Visit Preview Nov 5, 2024 4:24pm
examples-svelte-web ⬜️ Ignored (Inspect) Visit Preview Nov 5, 2024 4:24pm
examples-tailwind-web ⬜️ Ignored (Inspect) Visit Preview Nov 5, 2024 4:24pm
examples-vite-web ⬜️ Ignored (Inspect) Visit Preview Nov 5, 2024 4:24pm

}

impl TraceResult {
pub fn emit_errors(&self) {
Copy link
Member

Choose a reason for hiding this comment

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

So do proc macros mess up unused code detection? Could you add a decl to silence that warning?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it's actually the combination binary/library crate that's causing this. Because from the binary's perspective this is unused

@@ -80,7 +80,8 @@ pub async fn run(
// If the arg starts with "query" or "mutation", and ends in a bracket, it's
// likely a direct query If it doesn't, it's a file path, so we need to
// read it
let query = if (trimmed_query.starts_with("query") || trimmed_query.starts_with("mutation"))
let query = if (trimmed_query.starts_with("query")
|| trimmed_query.starts_with("mutation") | trimmed_query.starts_with('{'))
Copy link
Member

Choose a reason for hiding this comment

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

I'm surprised there isn't an warning for using bitor

Suggested change
|| trimmed_query.starts_with("mutation") | trimmed_query.starts_with('{'))
|| trimmed_query.starts_with("mutation") || trimmed_query.starts_with('{'))

@NicholasLYang NicholasLYang force-pushed the nicholasyang/refine-tracing-errors branch from 7e7fc15 to ca839d2 Compare November 5, 2024 16:23
@NicholasLYang NicholasLYang merged commit baa4eb5 into main Nov 5, 2024
40 checks passed
@NicholasLYang NicholasLYang deleted the nicholasyang/refine-tracing-errors branch November 5, 2024 17:06
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