Commit 057dab2
Fix azureterraform_azapi_get to return 400 BadRequest for invalid resource type or API version (#2657)
* Enhance error handling in AzApiDocsService and update status code in AzApiDocsGetCommandTests
* Add changelog entry for azapi_get 400 BadRequest fix
* Change `GetResourceApiVersions.ResourceVisitor` in BicepSchema tools to throw `InvalidDataException` for unknown resource types (#2840)
Change `GetResourceApiVersions.ResourceVisitor` in the BicepSchema tools to throw `InvalidDataException` for unknown resource types
`GetResourceApiVersions` threw a bare `Exception` (and an unhandled `KeyNotFoundException` when the provider existed but the resource type did not), which `AzApiDocsService` normalized via a broad catch-all that also misclassified real server-side faults as `400 BadRequest`. Throw `InvalidDataException` at the source instead, consistent with `LoadSingleResource`, and drop the catch-all so unexpected exceptions surface as `500`.
---------
Co-authored-by: vcolin7 <victor.y.asi@gmail.com>1 parent a7d3655 commit 057dab2
5 files changed
Lines changed: 16 additions & 5 deletions
File tree
- servers/Azure.Mcp.Server/changelog-entries
- tools
- Azure.Mcp.Tools.AzureTerraform
- src/Commands
- tests/Azure.Mcp.Tools.AzureTerraform.Tests
- Azure.Mcp.Tools.BicepSchema
- src/Services/ResourceProperties
- tests/Azure.Mcp.Tools.BicepSchema.Tests
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
55 | 56 | | |
56 | 57 | | |
57 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
58 | 65 | | |
59 | 66 | | |
60 | 67 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
139 | | - | |
| 139 | + | |
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
| |||
Lines changed: 4 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
89 | | - | |
| 89 | + | |
| 90 | + | |
90 | 91 | | |
91 | | - | |
| 92 | + | |
92 | 93 | | |
93 | 94 | | |
94 | | - | |
| 95 | + | |
95 | 96 | | |
96 | 97 | | |
97 | 98 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| |||
0 commit comments