Improve error.type classification for wrapped error.suggestion failures#7140
Improve error.type classification for wrapped error.suggestion failures#7140
error.type classification for wrapped error.suggestion failures#7140Conversation
Co-authored-by: JeffreyCA <9157833+JeffreyCA@users.noreply.github.com>
Co-authored-by: JeffreyCA <9157833+JeffreyCA@users.noreply.github.com>
error.type classification for wrapped error.suggestion failures
|
@copilot is there any way we could reduce some of the duplication as a result of this change? |
Co-authored-by: JeffreyCA <9157833+JeffreyCA@users.noreply.github.com>
Consolidated all sentinel The remaining typed error code computations in |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
/azp run azure-dev - cli |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Closes #7139
Builds on #7051
Context
MapErrorclassifiesErrorWithSuggestionearly, settingResultCode=error.suggestion— but the derivederror.typeattribute was just the raw Go type fromerrorType(). In practice this meant ARM deployment failures wrapped with suggestions showed up as*azapi.DeploymentErrorLineinstead ofservice.arm.deployment.failed, making the telemetry much less useful.Summary
This PR introduces
classifySuggestionType()to recognize structured inner errors before falling back toerrorType(). It reuses the same telemetry categories asMapError— ARM responses (service.arm.<status>), ARM deployments (service.arm.<op>.failed), extension service/local errors, tool execution errors, auth failures, network errors, and sentinels — soerror.typeis always a meaningful code rather than an opaque Go type name.The sentinel
errors.Is()checks are consolidated into a sharedclassifySentinel()function to avoid duplication betweenMapErrorandclassifySuggestionType. Both functions check structured types before sentinels, ensuring they always agree on the classification for a given error. A newTest_ClassifySuggestionType_MatchesMapErrortest exercises every error category through both paths and asserts they produce identical codes.Original prompt
error.typecategorization when ResultCode iserror.suggestion#7139📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.