diff --git a/src/actions/auth.js b/src/actions/auth.js index 2c0b32a68..a47f47d27 100644 --- a/src/actions/auth.js +++ b/src/actions/auth.js @@ -7,7 +7,7 @@ import { queryMeApi } from 'apis/me'; import authStatus from 'constants/authStatus'; import { pushErrorNotificationAndRollbarAndThrowError } from 'actions/toastNotification'; import { GraphqlError } from 'utils/errors'; -import * as ERROR_CODE from 'constants/errorCodeMsg'; +import * as ERROR_CODE from 'constants/errorCode'; export const SET_LOGIN = '@@auth/SET_LOGIN'; export const SET_USER = '@@auth/SET_USER'; diff --git a/src/components/ShareExperience/InterviewForm/TypeForm/index.js b/src/components/ShareExperience/InterviewForm/TypeForm/index.js index 40b8bde55..49fc74853 100644 --- a/src/components/ShareExperience/InterviewForm/TypeForm/index.js +++ b/src/components/ShareExperience/InterviewForm/TypeForm/index.js @@ -9,7 +9,7 @@ import Header, { CompanyJobTitleHeader } from '../../common/TypeFormHeader'; import SubmittableFormBuilder from '../../common/SubmittableFormBuilder'; import { createInterviewExperience } from 'actions/experiences'; import { GA_CATEGORY, GA_ACTION } from 'constants/gaConstants'; -import * as ERROR_CODE from 'constants/errorCodeMsg'; +import * as ERROR_CODE from 'constants/errorCode'; import { ERROR_CODE_MSG } from 'constants/errorCodeMsg'; import { DATA_KEY_COMPANY_NAME, diff --git a/src/components/ShareExperience/TimeSalaryForm/TypeForm.js b/src/components/ShareExperience/TimeSalaryForm/TypeForm.js index 1d82c8cf8..e6dcb3f25 100644 --- a/src/components/ShareExperience/TimeSalaryForm/TypeForm.js +++ b/src/components/ShareExperience/TimeSalaryForm/TypeForm.js @@ -53,7 +53,7 @@ import { getUserPseudoId } from 'utils/GAUtils'; import rollbar from 'utils/rollbar'; import { GA_MEASUREMENT_ID } from '../../../config'; -import * as ERROR_CODE from 'constants/errorCodeMsg'; +import * as ERROR_CODE from 'constants/errorCode'; const header =
; diff --git a/src/components/ShareExperience/WorkExperiencesForm/TypeForm.js b/src/components/ShareExperience/WorkExperiencesForm/TypeForm.js index 37e781f9e..80e962f4e 100644 --- a/src/components/ShareExperience/WorkExperiencesForm/TypeForm.js +++ b/src/components/ShareExperience/WorkExperiencesForm/TypeForm.js @@ -37,7 +37,7 @@ import { tabType } from '../../../constants/companyJobTitle'; import { createWorkExperienceWithRating } from 'actions/experiences'; import { transferKeyToSnakecase } from 'utils/objectUtil'; import { GA_CATEGORY, GA_ACTION } from 'constants/gaConstants'; -import * as ERROR_CODE from 'constants/errorCodeMsg'; +import * as ERROR_CODE from 'constants/errorCode'; import { ERROR_CODE_MSG } from 'constants/errorCodeMsg'; import { sendEvent } from 'utils/hotjarUtil'; diff --git a/src/components/ShareExperience/common/SubmittableFormBuilder.js b/src/components/ShareExperience/common/SubmittableFormBuilder.js index 6f492f710..0d38df01c 100644 --- a/src/components/ShareExperience/common/SubmittableFormBuilder.js +++ b/src/components/ShareExperience/common/SubmittableFormBuilder.js @@ -10,7 +10,7 @@ import ConfirmModal from 'common/FormBuilder/Modals/ConfirmModal'; import Footer from './TypeFormFooter'; import { useExperienceCount, useSalaryWorkTimeCount } from 'hooks/useCount'; import rollbar from 'utils/rollbar'; -import * as ERROR_CODE from 'constants/errorCodeMsg'; +import * as ERROR_CODE from 'constants/errorCode'; import { ERROR_CODE_MSG } from 'constants/errorCodeMsg'; const SubmittableTypeForm = ({ diff --git a/src/components/common/FormBuilder/index.js b/src/components/common/FormBuilder/index.js index d2ff8d80e..00f10f46a 100644 --- a/src/components/common/FormBuilder/index.js +++ b/src/components/common/FormBuilder/index.js @@ -24,7 +24,7 @@ import AnimatedPager from './AnimatedPager'; import styles from './FormBuilder.module.css'; import { OptionPropType } from './QuestionBuilder/Checkbox/PropTypes'; import rollbar from 'utils/rollbar'; -import * as ERROR_CODE from 'constants/errorCodeMsg'; +import * as ERROR_CODE from 'constants/errorCode'; import { ERROR_CODE_MSG } from 'constants/errorCodeMsg'; import { useDispatch } from 'react-redux'; import { pushErrorNotificationAndRollbar } from 'actions/toastNotification'; diff --git a/src/constants/errorCode.js b/src/constants/errorCode.js new file mode 100644 index 000000000..a3f3a7898 --- /dev/null +++ b/src/constants/errorCode.js @@ -0,0 +1,20 @@ +export const ER0001 = 'ER0001'; +export const ER0002 = 'ER0002'; +export const ER0003 = 'ER0003'; +export const ER0004 = 'ER0004'; +export const ER0005 = 'ER0005'; +export const ER0006 = 'ER0006'; +export const ER0007 = 'ER0007'; +export const ER0008 = 'ER0008'; +export const ER0009 = 'ER0009'; +export const ER0010 = 'ER0010'; +export const ER0011 = 'ER0011'; +export const ER0012 = 'ER0012'; +export const ER0013 = 'ER0013'; +export const ER0014 = 'ER0014'; +export const ER0015 = 'ER0015'; +export const ER0016 = 'ER0016'; +export const ER0018 = 'ER0018'; +export const ER0019 = 'ER0019'; +export const ER0020 = 'ER0020'; +export const ER0021 = 'ER0021'; diff --git a/src/constants/errorCodeMsg.js b/src/constants/errorCodeMsg.js index d66a8ddf5..d9c28c301 100644 --- a/src/constants/errorCodeMsg.js +++ b/src/constants/errorCodeMsg.js @@ -1,108 +1,89 @@ +import * as ERROR_CODE from './errorCode'; + const LOGIN_ERROR_MSG = '登入時發生錯誤,請再重試一次。若錯誤持續發生,請聯繫 findyourgoodjob@gmail.com'; const LOGIN_ERROR_MSG_CLEAN_BROWSER_DATA = '登入時發生錯誤,請清除瀏覽器資料,再重試一次。若錯誤持續發生,請聯繫 findyourgoodjob@gmail.com'; -export const ER0001 = 'ER0001'; -export const ER0002 = 'ER0002'; -export const ER0003 = 'ER0003'; -export const ER0004 = 'ER0004'; -export const ER0005 = 'ER0005'; -export const ER0006 = 'ER0006'; -export const ER0007 = 'ER0007'; -export const ER0008 = 'ER0008'; -export const ER0009 = 'ER0009'; -export const ER0010 = 'ER0010'; -export const ER0011 = 'ER0011'; -export const ER0012 = 'ER0012'; -export const ER0013 = 'ER0013'; -export const ER0014 = 'ER0014'; -export const ER0015 = 'ER0015'; -export const ER0016 = 'ER0016'; -export const ER0018 = 'ER0018'; -export const ER0019 = 'ER0019'; -export const ER0020 = 'ER0020'; -export const ER0021 = 'ER0021'; - // maintain a list of global error code export const ERROR_CODE_MSG = { - [ER0001]: { + [ERROR_CODE.ER0001]: { external: LOGIN_ERROR_MSG, internal: 'FB SDK is not ready', }, - [ER0002]: { + [ERROR_CODE.ER0002]: { external: LOGIN_ERROR_MSG, internal: 'FB SDK login failed', }, - [ER0003]: { + [ERROR_CODE.ER0003]: { external: LOGIN_ERROR_MSG, internal: 'FB login response is empty or does not have status field', }, - [ER0004]: { + [ERROR_CODE.ER0004]: { external: LOGIN_ERROR_MSG, internal: 'FB login failed: unauthorized', }, - [ER0005]: { + [ERROR_CODE.ER0005]: { external: LOGIN_ERROR_MSG, internal: 'Graphql mutation facebookLogin failed', }, - [ER0006]: { + [ERROR_CODE.ER0006]: { external: LOGIN_ERROR_MSG_CLEAN_BROWSER_DATA, internal: 'FB login failed: unknown auth status', }, - [ER0007]: { + [ERROR_CODE.ER0007]: { internal: 'Submit salary failed', }, - [ER0008]: { + [ERROR_CODE.ER0008]: { internal: 'Submit interview failed', }, - [ER0009]: { + [ERROR_CODE.ER0009]: { external: LOGIN_ERROR_MSG, internal: 'Cannot get id_token from Google auth API', }, - [ER0010]: { + [ERROR_CODE.ER0010]: { external: LOGIN_ERROR_MSG, internal: 'Cannot get token from Graphql googleLogin mutation response', }, - [ER0011]: { + [ERROR_CODE.ER0011]: { external: LOGIN_ERROR_MSG, internal: 'Graphql googleLogin mutation API failed with codes=UNAUTHENTICATED', }, - [ER0012]: { + [ERROR_CODE.ER0012]: { external: LOGIN_ERROR_MSG, internal: 'Graphql googleLogin mutation API failed with codes=FORBIDDEN, probably this user is deactivated', }, - [ER0013]: { + [ERROR_CODE.ER0013]: { external: LOGIN_ERROR_MSG, internal: 'Unknown error during Graphql googleLogin mutation', }, - [ER0014]: { + [ERROR_CODE.ER0014]: { external: LOGIN_ERROR_MSG, internal: 'Graphql facebookLogin mutation API failed with codes=UNAUTHENTICATED', }, - [ER0015]: { + [ERROR_CODE.ER0015]: { external: LOGIN_ERROR_MSG, internal: 'Graphql facebookLogin mutation API failed with codes=FORBIDDEN, probably this user is deactivated', }, - [ER0016]: { + [ERROR_CODE.ER0016]: { external: LOGIN_ERROR_MSG, internal: 'Unknown error during Graphql facebookLogin mutation', }, - [ER0018]: { + [ERROR_CODE.ER0018]: { internal: 'Unexpected error during submitting form data', }, - [ER0019]: { + [ERROR_CODE.ER0019]: { internal: 'Not submittable', }, - [ER0020]: { + [ERROR_CODE.ER0020]: { internal: 'Submit work experience failed', }, - [ER0021]: { + [ERROR_CODE.ER0021]: { internal: 'Warning without validation failure', }, };