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

http-client-java, improve error diagnostics for spotless failure #6300

Conversation

weidongxu-microsoft
Copy link
Contributor

@weidongxu-microsoft weidongxu-microsoft commented Mar 6, 2025

The failure is usually due to Java syntax problem. We want to print the file name and content for better diagnostics.

Sample output of this PR.

[main] ERROR com.microsoft.typespec.http.client.generator.TypeSpecPlugin - Failed to format file 'src/main/java/azure/clientgenerator/core/usage/implementation/ModelInOperationsImpl.java'
177:15: error: illegal unicode escape
174 
175     /**
176      * Serialize the 'OrphanModel' as request body.
177      * data\userdomain
178      * 
179      * Expected body parameter: 
180      * ```json

I've also add logic to parse the JAR output to diagnostics/trace for tsp.

image

image

autorest.java Azure/autorest.java#3035

@microsoft-github-policy-service microsoft-github-policy-service bot added the emitter:client:java Issue for the Java client emitter: @typespec/http-client-java label Mar 6, 2025
@azure-sdk
Copy link
Collaborator

azure-sdk commented Mar 6, 2025

❌ There is undocummented changes. Run chronus add to add a changeset or click here.

The following packages have changes but are not documented.

  • @typespec/http-client-java
Show changes

@azure-sdk
Copy link
Collaborator

azure-sdk commented Mar 6, 2025

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

@weidongxu-microsoft weidongxu-microsoft force-pushed the http-client-java_better-log-for-spotless branch from f9fb119 to e9a5290 Compare March 7, 2025 03:23
@weidongxu-microsoft
Copy link
Contributor Author

I've got to merge it early, as I've put some fix for nightly build here as well 8eefe15

I will handle any feedback in separate PR.

@weidongxu-microsoft weidongxu-microsoft added this pull request to the merge queue Mar 7, 2025
Merged via the queue into microsoft:main with commit 94a9b9e Mar 7, 2025
26 checks passed
@weidongxu-microsoft weidongxu-microsoft deleted the http-client-java_better-log-for-spotless branch March 7, 2025 11:28
@srnagar
Copy link
Member

srnagar commented Mar 7, 2025

Nice! This is super useful to troubleshoot quickly. Knowing which file is not syntactically correct helps in knowing where the issue is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
emitter:client:java Issue for the Java client emitter: @typespec/http-client-java
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants