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;
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.