
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.
通过监听/主动捕获 error 以及性能信息,获取相关信息后执行特定操作(数据上传记录等)。
可捕获的异常类型包括:
可监控页面加载各个阶段所用时间、页面资源加载时间。
信息将于页面 load 事件时上报
上报方法可自定义,上报时机分为:
页面加载完成后上报
window.addEventListener,可捕获 JavaScript 执行错误,资源加载错误,未catch处理的Promise错误XMLHttpRequest / fetch 实现监听 HTTP 请求错误
<script src="https://unpkg.com/hibug"></script>
<script>
hibug.init({
report(errorList) {
// 上传错误至服务端
}
})
</script>
1.安装
npm install hibug --save
如果想用 yarn
yarn add hibug
2.在 根组件文件中添加
import hibug from 'hibug'
class Root extends React.Component {
componentDidMount() {
hibug.init({
report(errorList) {
// 上传错误至服务端
}
})
}
}
针对一些特殊需求的错误 使用主动捕获(使用装饰器)
例如在 react 中
import { caughtError } from 'hibug';
class Test extends React.Component {
@caughtError // success
send() {
// ...
}
}
请注意箭头函数使用 caughtError 捕获不到错误信息,例如
import { caughtError } from 'hibug';
class Test extends React.Component {
@caughtError // fail
send = () => {
// ...
}
}
针对一些不能使用装饰器或自定义信息使用 reportInfo
import { reportInfo } from 'hibug';
class Test extends React.Component {
send() {
try {
// ...
} catch(e) {
reportInfo(e)
}
}
}
import { reportInfo } from 'hibug';
class Test extends React.Component {
hello() {
reportInfo('hello')
}
}
Copyright (c) 2019 Wei Changhua
FAQs
A library for collecting front-end error log.
We found that hibug demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.