📅  最后修改于: 2022-03-11 15:03:47.409000             🧑  作者: Mango
componentDidCatch(error, info) {
this.reactError = error
console.log(info)
this.setState({ catchError: true })
}
sendError() {
fetch('/errorlog', {
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
method: "POST",
body: JSON.stringify({ message: this.props.type + ' - ' + this.props.error.message, stack: this.props.error.stack })
})
}