Skip to content

Instantly share code, notes, and snippets.

View homocodian's full-sized avatar

Ashish Singh homocodian

View GitHub Profile
@homocodian
homocodian / firebase-error.js
Last active July 27, 2023 08:21
Get meaningful message from firebase admin error code and show it to user without checking for each and every error code and then showing different messages based on it.
export default function getErrorMessage(error) {
switch (error.code) {
case "auth/app-deleted":
return "App service discontinued";
case "auth/expired-action-code":
return "Something went wrong, please try again later";
case "auth/invalid-action-code":
return "Something went wrong, please try again later";
case "auth/user-disabled":
return "Unauthorized user, please contact developer for more info";