File tree Expand file tree Collapse file tree 2 files changed +8
-14
lines changed Expand file tree Collapse file tree 2 files changed +8
-14
lines changed Original file line number Diff line number Diff line change @@ -186,18 +186,15 @@ export async function uxLookup(
186
186
const orgResult = await sockSdk . getOrganizations ( )
187
187
if ( ! orgResult . success ) {
188
188
if ( orgResult . status === 429 ) {
189
- throw new Error (
190
- `API token quota exceeded: ${ orgResult . error } `
191
- )
189
+ throw new Error ( `API token quota exceeded: ${ orgResult . error } ` )
192
190
}
193
191
throw new Error (
194
192
`Failed to fetch Socket organization info: ${ orgResult . error } `
195
193
)
196
194
}
197
195
const { organizations } = orgResult . data
198
- const orgs : Array <
199
- Exclude < ( typeof organizations ) [ string ] , undefined >
200
- > = [ ]
196
+ const orgs : Array < Exclude < ( typeof organizations ) [ string ] , undefined > > =
197
+ [ ]
201
198
for ( const org of Object . values ( organizations ) ) {
202
199
if ( org ) {
203
200
orgs . push ( org )
Original file line number Diff line number Diff line change @@ -16,17 +16,14 @@ import type {
16
16
17
17
export function handleUnsuccessfulApiResponse < T extends SocketSdkOperations > (
18
18
_name : T ,
19
- result : SocketSdkErrorType < T >
19
+ sockSdkError : SocketSdkErrorType < T >
20
20
) : never {
21
- // SocketSdkErrorType['error'] is not typed.
22
- const resultErrorMessage = ( result as { error ?: Error } ) . error ?. message
23
- const message =
24
- typeof resultErrorMessage === 'string'
25
- ? resultErrorMessage
26
- : 'No error message returned'
27
- if ( result . status === 401 || result . status === 403 ) {
21
+ const message = sockSdkError . error || 'No error message returned'
22
+ const { status } = sockSdkError
23
+ if ( status === 401 || status === 403 ) {
28
24
// Lazily access constants.spinner.
29
25
const { spinner } = constants
26
+
30
27
spinner . stop ( )
31
28
32
29
throw new AuthError ( message )
You can’t perform that action at this time.
0 commit comments