Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Commit

Permalink
🐛 Fix error code for "cannot delete email"
Browse files Browse the repository at this point in the history
  • Loading branch information
AnandChowdhary committed Apr 28, 2019
1 parent cf70881 commit 2ac9f6f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/interfaces/enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ export enum EventType {
EMAIL_CREATED = "email.created",
EMAIL_UPDATED = "email.updated",
EMAIL_DELETED = "email.deleted",
EMAIL_VERIFIED = "email.verified",
EMAIL_CANNOT_DELETE = "email.cannotDelete"
EMAIL_VERIFIED = "email.verified"
}

export enum ErrorCode {
Expand All @@ -47,7 +46,8 @@ export enum ErrorCode {
USER_NOT_FOUND = "404/user-not-found",
INVALID_LOGIN = "401/invalid-login",
INSUFFICIENT_PERMISSION = "401/insufficient-permission",
DEFAULT = "500/server-error"
DEFAULT = "500/server-error",
EMAIL_CANNOT_DELETE = "400/email.cannotDelete"
}

export enum Templates {
Expand Down
2 changes: 1 addition & 1 deletion src/rest/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export const deleteEmailFromUser = async (
await updateUser(userId, { primaryEmail: nextVerifiedEmail });
}
} else {
throw new Error(EventType.EMAIL_CANNOT_DELETE);
throw new Error(ErrorCode.EMAIL_CANNOT_DELETE);
}
await deleteEmail(emailId);
await createEvent(
Expand Down

0 comments on commit 2ac9f6f

Please sign in to comment.