Update logger example to account for CompilerDiagnostic in CompilerError.details
#8251
+3
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Disclaimer: I swear that this is not AI slop or any other kind of spam, but a real problem I encountered by following the current docs, which lead me to dig into the source code.
I just want to correct the example so others have an easier time following the docs.
event.detailin the logger example could either beCompilerErrorDetailorCompilerDiagnostic, yet the example only handled the simpler (but deprecated)CompilerErrorDetail.In reality, I've seen both of these show up in the
loggerfunction.This adds a call to
primaryLocation(if present) to account for the different structure ofCompilerDiagnostic-locis not present there.