Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit93b289e

Browse files
committed
improved error handling
1 parent02acac9 commit93b289e

File tree

3 files changed

+40
-0
lines changed

3 files changed

+40
-0
lines changed

‎CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
All notable changes to this project will be documented in this file.
33
This project adheres to[Semantic Versioning](http://semver.org/).
44

5+
##[0.10.9] - 2016-07-24
6+
- improved error handling
7+
58
##[0.10.2] - 2016-06-28
69
- rely on core-coderoad@0.5
710
- require newer version of test runners

‎lib/components/SidePanel/SidePanel.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,23 @@ var SidePanel = (function (_super) {
3838
),
3939
React.createElement(index_1.Alert,null)));
4040
};
41+
SidePanel.prototype.componentWillMount=function(){
42+
this.startErrorLog();
43+
};
44+
SidePanel.prototype.startErrorLog=function(){
45+
window.onerror=function(message,file,line,column,errorObject){
46+
column=column||(window.event&&window.event.errorCharacter);
47+
varstack=errorObject ?errorObject.stack :null;
48+
vardata={
49+
message:message,
50+
file:file,
51+
line:line,
52+
column:column,
53+
errorStack:stack,
54+
};
55+
returnfalse;
56+
};
57+
};
4158
SidePanel=__decorate([
4259
react_redux_1.connect(function(state){return({
4360
isWindowOpen:state.window,

‎src/components/SidePanel/SidePanel.tsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,24 @@ export default class SidePanel extends React.Component<{
3737
</section>
3838
);
3939
}
40+
privatecomponentWillMount(){
41+
this.startErrorLog();
42+
}
43+
privatestartErrorLog(){
44+
window.onerror=(message,file,line,column,errorObject)=>{
45+
column=column||(window.event&&window.event.errorCharacter);
46+
conststack=errorObject ?errorObject.stack :null;
47+
48+
constdata={
49+
message,
50+
file,
51+
line,
52+
column,
53+
errorStack:stack,
54+
};
55+
56+
// call to server
57+
returnfalse;
58+
};
59+
}
4060
};

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp