Skip to content

Commit

Permalink
[PAY-2091] Update aao error emojis and libs mapped error (#6593)
Browse files Browse the repository at this point in the history
Co-authored-by: Saliou Diallo <saliou@audius.co>
  • Loading branch information
sddioulde and Saliou Diallo authored Nov 7, 2023
1 parent 73e7572 commit fd12b98
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
4 changes: 4 additions & 0 deletions packages/common/src/utils/aaoErrorCodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ const aaoErrorEmojis = {
10: '😣',
11: '😦',
12: '😔',
13: '🫨',
15: '🥴',
16: '😬',
18: '🤧',
'-1': '🤨'
}
/**
Expand Down
13 changes: 3 additions & 10 deletions packages/libs/src/api/Rewards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -574,26 +574,19 @@ export class Rewards extends Base {
const response: AxiosResponse<{
result: string
errorCode?: number
needs: keyof typeof GetAttestationError
}> = await axios(request)
// if attestation is successful, 'result' represents a signature
// otherwise, 'result' is false
// - there may or may not be a value for `needs` if the attestation fails
// - depending on whether the user can take an action to attempt remediation
const { result, errorCode, needs } = response.data
const { result, errorCode } = response.data

if (!result) {
logger.error(
`Failed to get AAO attestation${needs ? `: needs ${needs}` : ''}`
)
const mappedErr = needs
? GetAttestationError[needs] ||
GetAttestationError.AAO_ATTESTATION_UNKNOWN_RESPONSE
: GetAttestationError.AAO_ATTESTATION_REJECTION
logger.error('Failed to get AAO attestation')
return {
success: null,
aaoErrorCode: errorCode,
error: mappedErr
error: GetAttestationError.AAO_ATTESTATION_REJECTION
}
}

Expand Down

0 comments on commit fd12b98

Please sign in to comment.