Skip to content

Commit

Permalink
feat(release): v0.1.0-beta.2 (#5)
Browse files Browse the repository at this point in the history
## v0.1.0-beta.2 - 2024-09-16

### Added

* LRO and Pageable errors in Fabric format `ResponseError` instead of
AzCore format.
  • Loading branch information
DariuszPorowski authored Sep 16, 2024
1 parent f3a4e03 commit 7cb74ba
Show file tree
Hide file tree
Showing 37 changed files with 537 additions and 72 deletions.
12 changes: 12 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${fileDirname}"
}
]
}
26 changes: 23 additions & 3 deletions fabric/admin/domains_client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion fabric/admin/externaldatashares_client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion fabric/admin/items_client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion fabric/admin/tenants_client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion fabric/admin/users_client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion fabric/admin/workspaces_client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion fabric/core/capacities_client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 24 additions & 4 deletions fabric/core/deploymentpipelines_client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions fabric/core/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,32 @@ func NewResponseError(resp *http.Response) error {
return err
}

var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(respBody, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling error: %v", err)
}

// handle LRO result error
if rawMsg["error"] != nil && rawMsg["status"] != nil {
var errorMap map[string]any
if err := json.Unmarshal(rawMsg["error"], &errorMap); err != nil {
return fmt.Errorf("unmarshalling error field: %v", err)
}

errorMap["requestId"] = resp.Header.Get("requestId")
errorMap["moreDetails"] = []map[string]any{
{
"errorCode": string(rawMsg["status"]),
"message": "Long Running Operation: " + string(rawMsg["status"]),
},
}

respBody, err = json.Marshal(errorMap)
if err != nil {
return fmt.Errorf("marshalling error field: %v", err)
}
}

var errResp ErrorResponse
if err := errResp.UnmarshalJSON(respBody); err != nil {
return err
Expand Down
6 changes: 5 additions & 1 deletion fabric/core/externaldatashares_client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 36 additions & 4 deletions fabric/core/git_client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 7cb74ba

Please sign in to comment.