Skip to content

Commit 70010ef

Browse files
authored
fix: move error code to i18 in order to be displayed on prod env (#3072)
1 parent 8723bf1 commit 70010ef

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

backend/src/services/integrationService.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1443,15 +1443,16 @@ export default class IntegrationService {
14431443
const errorType = String(error.response.data.type)
14441444
const isTwoFactorRequired =
14451445
errorType.includes('two_factor_required') || errorType.includes('2nd_factor_required')
1446+
14461447
if (isTwoFactorRequired) {
1447-
throw new Error400(this.options.language, 'Two-factor authentication code is required')
1448+
throw new Error400(this.options.language, 'errors.groupsio.isTwoFactorRequired')
14481449
}
14491450
const invalidCredentials =
14501451
errorType.includes('invalid password') || errorType.includes('invalid email')
1451-
if (invalidCredentials) throw new Error400(this.options.language, 'Invalid email or password')
1452+
if (invalidCredentials)
1453+
throw new Error400(this.options.language, 'errors.groupsio.invalidCredentials')
14521454
const invalid2FA = errorType.includes('2nd_factor_wrong')
1453-
if (invalid2FA)
1454-
throw new Error400(this.options.language, 'Invalid Two-factor authentication code')
1455+
if (invalid2FA) throw new Error400(this.options.language, 'errors.groupsio.invalid2FA')
14551456
throw error
14561457
}
14571458
}

services/libs/common/src/i18n/en.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,11 @@ const en = {
160160
invalidCredentials:
161161
'The given credentials were found to be invalid. Please check the credentials and try again',
162162
},
163+
groupsio: {
164+
isTwoFactorRequired: 'Two-factor authentication code is required',
165+
invalidCredentials: 'Invalid email or password',
166+
invalid2FA: 'Invalid Two-factor authentication code',
167+
},
163168
alreadyExists: '{0}',
164169
},
165170

0 commit comments

Comments
 (0)