How can i set a variable to the message of an error? This is my code:
.catch(console.error).then((err) => {
var x = err.message;
)};
And i am getting this error:
Cannot read property 'message' of undefined
How can i set a variable to the message of an error? This is my code:
.catch(console.error).then((err) => {
var x = err.message;
)};
And i am getting this error:
Cannot read property 'message' of undefined
You get the error in the catch
call:
.catch((err) => {
console.error(err);
var x = err.message;
});