MCPcopy Create free account
hub / github.com/artsy/force / formatErrorMessage

Function formatErrorMessage

src/Components/AuthDialog/Utils/formatErrorMessage.ts:1–22  ·  view source on GitHub ↗
(error: Error)

Source from the content-addressed store, hash-verified

1export const formatErrorMessage = (error: Error) => {
2 switch (error.message) {
3 case "invalid two-factor authentication code":
4 return "The code you entered is invalid. Please try again."
5
6 case "invalid email or password":
7 return "The email or password you entered is invalid. Please try again."
8
9 case "account locked, try again in a few minutes":
10 return "Your account has been locked. Please try again in a few minutes."
11
12 case "User Already Exists":
13 return "An account with this email already exists."
14
15 case `Unexpected token '<', "<!DOCTYPE "... is not valid JSON`:
16 case `Unexpected token '<', "<html> <"... is not valid JSON`:
17 return "An error occurred. Please try again."
18
19 default:
20 return error.message
21 }
22}

Callers 7

handleSubmitFunction · 0.90
handleSubmitFunction · 0.90
AuthDialogLoginFunction · 0.90
AuthDialogForgotPasswordFunction · 0.90
AuthDialogSignUpFunction · 0.90
PasswordFormFunction · 0.90
handleSubmitFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected