newImage().src='/remote/image/notdeinfed.png'
try/catch
try{
console.log(notdefined);
}catch(e){
}
constnotdefined,
setTimeout(()=>{
},0)
window.onerror
/**
*/
window.onerror=function(message,source,lineno,colno,error){
returntrue;
window.addEventListener
window.addEventListener('error',(error)=>{
},true)
newPromise((resolve,reject)=>{
JSON.parse('')
resolve();
})
}catch(err){
console.error('intrycatch',err)
}).catch(err=>{
console.log('incatchfn',err)
constgetJSON=async()=>{
thrownewError('innererror')
constmakeRequest=async()=>{
JSON.parse(getJSON());
console.log('outer',err);
};
makeRequest()
awaitmakeRequest()
import(/*webpackChunkName:"incentive"*/'./index').then(module=>{
module.default()
}).catch((err)=>{
console.error('incatchfn',err)
constmodule=awaitimport(/*webpackChunkName:"incentive"*/'./index');
window.addEventListener("unhandledrejection",function(e){
});
Vue.config.errorHandler=function(err){
throwerr
classErrorBoundaryextendsReact.Component{
constructor(props){
super(props);
this.state={hasError:false};
staticgetDerivedStateFromError(error){
return{hasError:true};
componentDidCatch(error,errorInfo){
logErrorToMyService(error,errorInfo);
render(){
if(this.state.hasError){
return
Somethingwentwrong.
;returnthis.props.children;
classAppextendsReact.Component{
return(
)
constscript=document.createElement('script');
script.crossOrigin='anonymous';
document.body.appendChild(script);
window.onerror=function(message,url,line,column,error){
console.log(message,url,line,column,error);
throwe;
functionwrapErrors(fn){
//don'twrapfunctionmorethanonce
if(!fn.__wrapped__){
fn.__wrapped__=function(){
returnfn.apply(this,arguments);
throwe;//re-throwtheerror
returnfn.__wrapped__;
wrapErrors(foo)()
constoriginAddEventListener=EventTarget.prototype.addEventListener;
EventTarget.prototype.addEventListener=function(type,listener,options){
constwrappedListener=function(...args){
returnlistener.apply(this,args);
catch(err){
throwerr;
returnoriginAddEventListener.call(this,type,wrappedListener,options);
(function(w){
w._error_storage_=[];
functionerrorhandler(){
w._error_storage_&&w._error_storage_.push([].slice.call(arguments));
w.addEventListener&&w.addEventListener("error",errorhandler,true);
vartimes=3,
appendScript=functionappendScript(){
varsc=document.createElement("script");
sc.async=!0,
sc.crossOrigin="anonymous",
sc.onerror=function(){
times--,
times>0&&setTimeout(appendScript,1500)
},
document.head&&document.head.appendChild(sc);
setTimeout(appendScript,1500);
})(window);
consterrorKey=`${+newDate()}@${randomString(8)}`
len=len||32;
letchars='ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678';
letmaxPos=chars.length;
returnpwd;
consteventKey=compressString(String(e.message),String(e.colno)+String(e.lineno))
functioncompressString(str,key){
letchars='ABCDEFGHJKMNPQRSTWXYZ';
if(!str||!key){
return'null';
letn=0,
m=0;
for(leti=0;i n+=str[i].charCodeAt(); for(letj=0;j m+=key[j].charCodeAt(); letnum=n+''+key[key.length-1].charCodeAt()+m+str[str.length-1].charCodeAt(); if(num){ num=num+chars[num[num.length-1]]; returnnum; constlocalStorage=window.localStorage; exportfunctionsetItem(key,repeat){ if(!key){ key='unknow'; if(has(key)){ constvalue=getItem(key); if(value>=repeat){ storeStorage[key]={ value:value+1, time:Date.now() }else{ value:1, returnfalse; module.exports=asyncctx=>{ const{query}=ctx.request; check(['mobile','network','ip','system','ua',......],query); ctx.type='application/json'; //1000ms constTICK=1000; constMAX_LIMIT=2000; letmaxLimit=MAX_LIMIT; consttask=()=>{ maxLimit=MAX_LIMIT; task(); },TICK); constcheck=()=>{ if(maxLimit<=0){ maxLimit--; if(Math.random()<0.2){ webpackJsonp([1],[ function(e,t,i){...}, ... ]) constsourceMap=require('source-map') constgetPosition=async(map,rolno,colno)=>{ constconsumer=awaitnewsourceMap.SourceMapConsumer(map) constposition=consumer.originalPositionFor({ line:rolno, column:colno position.content=consumer.sourceContentFor(position.source)