Skip to content

Commit

Permalink
fix(types)!: align SoapFault type to network error response
Browse files Browse the repository at this point in the history
Add Detail.Error.Trace and Code fields.
Remove Detail.Error.Detail field

BREAKING CHANGE: Remove Detail.Error.Detail field from SoapFault type
Refs: SHELL-203 (#433)
  • Loading branch information
beawar committed Jun 25, 2024
1 parent 57f771b commit 367dcb4
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
10 changes: 7 additions & 3 deletions api-extractor/carbonio-shell-ui.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1319,11 +1319,15 @@ export interface SoapContext extends Omit<RawSoapContext, 'notify'> {

// @public (undocumented)
interface SoapFault {
// (undocumented)
Code: {
Value: string;
};
// (undocumented)
Detail: {
Error: {
Code: string;
Detail: string;
Trace: string;
};
};
// (undocumented)
Expand Down Expand Up @@ -1695,8 +1699,8 @@ interface ZimletProp {
// lib/types/misc/index.d.ts:138:5 - (ae-forgotten-export) The symbol "SortBy" needs to be exported by the entry point lib.d.ts
// lib/types/network/index.d.ts:107:5 - (ae-forgotten-export) The symbol "AccountACEInfo" needs to be exported by the entry point lib.d.ts
// lib/types/network/soap.d.ts:11:5 - (ae-forgotten-export) The symbol "NameSpace" needs to be exported by the entry point lib.d.ts
// lib/types/network/soap.d.ts:33:5 - (ae-forgotten-export) The symbol "SoapFault" needs to be exported by the entry point lib.d.ts
// lib/types/network/soap.d.ts:62:5 - (ae-forgotten-export) The symbol "SoapSearchFolder" needs to be exported by the entry point lib.d.ts
// lib/types/network/soap.d.ts:36:5 - (ae-forgotten-export) The symbol "SoapFault" needs to be exported by the entry point lib.d.ts
// lib/types/network/soap.d.ts:65:5 - (ae-forgotten-export) The symbol "SoapSearchFolder" needs to be exported by the entry point lib.d.ts
// lib/types/workers/index.d.ts:12:5 - (ae-forgotten-export) The symbol "SyncMessage" needs to be exported by the entry point lib.d.ts

```
10 changes: 8 additions & 2 deletions src/network/fetch.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,14 @@ describe('Fetch', () => {
HttpResponse.json({
Body: {
Fault: {
Code: {
Value: ''
},
Reason: { Text: 'Controlled error: auth required' },
Detail: {
Error: {
Code: 'service.AUTH_REQUIRED',
Detail: ''
Trace: ''
}
}
}
Expand All @@ -50,11 +53,14 @@ describe('Fetch', () => {
HttpResponse.json({
Body: {
Fault: {
Code: {
Value: ''
},
Reason: { Text: 'Controlled error: auth expired' },
Detail: {
Error: {
Code: 'service.AUTH_EXPIRED',
Detail: ''
Trace: ''
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/network/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ const handleResponse = <R extends Record<string, unknown>>(
}
console.error(
new Error(
`${(<ErrorSoapResponse>res).Body.Fault.Detail?.Error?.Detail}: ${
`${(<ErrorSoapResponse>res).Body.Fault.Detail?.Error?.Code}: ${
(<ErrorSoapResponse>res).Body.Fault.Reason?.Text
}`
)
Expand Down
5 changes: 4 additions & 1 deletion src/types/network/soap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,15 @@ export interface SoapFault {
Detail: {
Error: {
Code: string;
Detail: string;
Trace: string;
};
};
Reason: {
Text: string;
};
Code: {
Value: string;
};
}

export type ErrorSoapBodyResponse = {
Expand Down

0 comments on commit 367dcb4

Please sign in to comment.