How to Search text in Error

I need to search a text in Error Message, I tried to use .find and .contains method on string but it is not working.

Here is the code:
. catch (error => {
console.log( "error message : " + error.find( “already registered” ));

        }) 

Thanks

Hey,

Please provide more information about exactly what it is that you are trying to do and what issue you are having with your code.

Thank you!

Dara | Corvid Team