Skip to content

Commit aca5a14

Browse files
pvdzjdalton
andauthored
Fix fix command when server rejects request (#655)
* Fix fix command when server rejects request * Update src/utils/alerts-map.mts Signed-off-by: John-David Dalton <[email protected]> * Update src/utils/alerts-map.mts Signed-off-by: John-David Dalton <[email protected]> * Remove condition --------- Signed-off-by: John-David Dalton <[email protected]> Co-authored-by: John-David Dalton <[email protected]>
1 parent 426e673 commit aca5a14

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/utils/alerts-map.mts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import { arrayUnique } from '@socketsecurity/registry/lib/arrays'
2+
import { debugFn } from '@socketsecurity/registry/lib/debug'
3+
import { logger } from '@socketsecurity/registry/lib/logger'
24

35
import { extractPurlsFromPnpmLockfile } from './pnpm.mts'
46
import { getPublicToken, setupSdk } from './sdk.mts'
57
import { addArtifactToAlertsMap } from './socket-package-alert.mts'
8+
import constants from '../constants.mts'
69

710
import type { CompactSocketArtifact } from './alert/artifact.mts'
811
import type {
@@ -117,6 +120,16 @@ export async function getAlertsMapFromPurls(
117120
throw new Error(
118121
`Socket API server error (${statusCode}): ${statusMessage}`,
119122
)
123+
} else {
124+
const { spinner } = constants
125+
spinner.stop()
126+
debugFn('Received a result=false:', batchResult)
127+
logger.fail(
128+
`Received a ${batchResult.status} response from Socket API which we consider a permanent failure:`,
129+
batchResult.error,
130+
batchResult.cause ? `( ${batchResult.cause} )` : '',
131+
)
132+
break
120133
}
121134
remaining -= 1
122135
if (spinner && remaining > 0) {

0 commit comments

Comments
 (0)