1

I have a situation where I need to throw an error. The error must match FirebaseError interface.

I tried to import this interface

import { FirebaseError } from '@firebase/util'; 

But I don't know how to use it

throw new FirebaseError ??? 

1 Answer 1

3

FirebaseErroris an interface. You should create your custom error class that extends from FirebaseError and throw it:

class FirebaseSignInError extends FirebaseError { } 

After that, just call:

throw new FirebaseSignInError

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks it worked. throw new FirebaseSignInError('code', 'message');
For the TypeScript users its class FirebaseErrorTest implements FirebaseError {...}

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.