File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -186,18 +186,15 @@ export async function uxLookup(
186186 const orgResult = await sockSdk . getOrganizations ( )
187187 if ( ! orgResult . success ) {
188188 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 } ` )
192190 }
193191 throw new Error (
194192 `Failed to fetch Socket organization info: ${ orgResult . error } `
195193 )
196194 }
197195 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+ [ ]
201198 for ( const org of Object . values ( organizations ) ) {
202199 if ( org ) {
203200 orgs . push ( org )
Original file line number Diff line number Diff line change @@ -16,17 +16,14 @@ import type {
1616
1717export function handleUnsuccessfulApiResponse < T extends SocketSdkOperations > (
1818 _name : T ,
19- result : SocketSdkErrorType < T >
19+ sockSdkError : SocketSdkErrorType < T >
2020) : 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 ) {
2824 // Lazily access constants.spinner.
2925 const { spinner } = constants
26+
3027 spinner . stop ( )
3128
3229 throw new AuthError ( message )
You can’t perform that action at this time.
0 commit comments