
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
react-error-catch
Advanced tools
| 异常类型 | 同步方法 | 异步方法 | 资源加载 | Promise | async/await |
|---|---|---|---|---|---|
| try/catch | √ | √ | |||
| onerror | √ | √ | |||
| error 事件监听 | √ | √ | √ | ||
| unhandledrejection 事件监听 | √ | √ |
错误表现类型:
执行 npm install react-error-catch 或者 yarn add react-error-catch 来进行引入
紧接着在项目内:
import ErrorCatch from "react-error-catch";
const App = () => {
return (
<ErrorCatch
app="react-catch"
user="bcyg"
delay={5000}
max={1}
filters={[]}
onCatch={(errors) => {
console.log("报错咯");
// 上报异常信息到后端,动态创建标签方式
new Image().src = `http://localhost:3000/log/report?info=${JSON.stringify(
errors
)}`;
}}
>
<Main />
</ErrorCatch>
);
};
export default App;
| 属性 | 描述 | 类型 | 默认值 |
|---|---|---|---|
| errorRender | 当捕获到组件渲染错误时,降级渲染样式 | React.ReactNode | <h1>Something went wrong.</h1> |
| user | 谁触发了错误 | "unkonwn user" | |
| app | 触发错误的 app | string | "unkonwn app" |
| token | 触发错误的 token | string | - |
| language | 访问网站语言 language | string | - |
| max | 当捕获到的错误超过设置 max 值时,触发 onCatch 事件 | number | 1 |
| filters | 定义需要过滤的错误 | string[] | - |
| onCatch | 当满足设置条件时的错误捕获回调 | (error: ErrorInfo[]) => any | - |
FAQs
react error catch!
We found that react-error-catch demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.