djbalinD
Convex Community2y ago
2 replies
djbalin

Convex Auth: Error types for signUp/signIn

Hi, is there a way to know the possible types of errors that the signUp / signIn functions can throw? I want to disambiguate between error causes on the frontend.

Specifically, I want to do something like:

try {
  await signIn(...);
} catch (error) {
  switch (error.type){
    case InvalidId: alert("No user with that username found");
    case InvalidPassword: alert("Incorrect password");
    case TooManyAttempts: alert("Too many attempts to log in, try again in 5 minutes");
    default: alert("Something went wrong, please try again")
}
Was this page helpful?