Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
renderjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Ivan Tyagov
renderjs
Commits
58c3f176
Commit
58c3f176
authored
Jul 12, 2016
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Provides more informations in case of error.
parent
a1f6e2da
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
75 additions
and
26 deletions
+75
-26
Gruntfile.js
Gruntfile.js
+3
-1
renderjs.js
renderjs.js
+72
-25
No files found.
Gruntfile.js
View file @
58c3f176
...
@@ -65,7 +65,9 @@ module.exports = function (grunt) {
...
@@ -65,7 +65,9 @@ module.exports = function (grunt) {
'
MutationObserver
'
,
'
MutationObserver
'
,
'
Blob
'
,
'
Blob
'
,
'
FileReader
'
,
'
FileReader
'
,
'
Node
'
'
Node
'
,
'
navigator
'
,
'
Event
'
]
]
}
}
},
},
...
...
renderjs.js
View file @
58c3f176
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* http://www.renderjs.org/documentation
* http://www.renderjs.org/documentation
*/
*/
(
function
(
document
,
window
,
RSVP
,
DOMParser
,
Channel
,
MutationObserver
,
(
function
(
document
,
window
,
RSVP
,
DOMParser
,
Channel
,
MutationObserver
,
Node
,
FileReader
,
Blob
)
{
Node
,
FileReader
,
Blob
,
navigator
,
Event
)
{
"
use strict
"
;
"
use strict
"
;
function
readBlobAsDataURL
(
blob
)
{
function
readBlobAsDataURL
(
blob
)
{
...
@@ -99,52 +99,99 @@
...
@@ -99,52 +99,99 @@
var
i
,
var
i
,
body
,
body
,
container
,
container
,
paragraph
;
paragraph
,
link
,
error
;
if
(
is_page_unloaded
)
{
if
(
is_page_unloaded
)
{
/*global console*/
/*global console*/
console
.
info
(
'
-- Error dropped, as page is unloaded
'
);
console
.
info
(
'
-- Error dropped, as page is unloaded
'
);
console
.
info
(
e
);
console
.
info
(
e
);
return
;
return
;
}
}
if
(
e
.
constructor
===
XMLHttpRequest
)
{
e
=
{
readyState
:
e
.
readyState
,
status
:
e
.
status
,
statusText
:
e
.
statusText
,
response_headers
:
e
.
getAllResponseHeaders
()
};
}
if
(
e
.
constructor
===
Array
||
e
.
constructor
===
String
||
e
.
constructor
===
Object
)
{
try
{
e
=
JSON
.
stringify
(
e
);
}
catch
(
ignore
)
{
}
}
error_list
.
push
(
e
);
error_list
.
push
(
e
);
// Add error handling stack
error_list
.
push
(
new
Error
(
'
stopping renderJS
'
));
body
=
document
.
getElementsByTagName
(
'
body
'
)[
0
];
body
=
document
.
getElementsByTagName
(
'
body
'
)[
0
];
while
(
body
.
firstChild
)
{
while
(
body
.
firstChild
)
{
body
.
removeChild
(
body
.
firstChild
);
body
.
removeChild
(
body
.
firstChild
);
}
}
container
=
document
.
createElement
(
"
section
"
);
paragraph
=
document
.
createElement
(
"
h1
"
);
paragraph
.
textContent
=
'
Unhandled Error
'
;
container
.
appendChild
(
paragraph
);
paragraph
=
document
.
createElement
(
"
p
"
);
paragraph
.
textContent
=
'
Please report this error to the support team
'
;
container
.
appendChild
(
paragraph
);
paragraph
=
document
.
createElement
(
"
p
"
);
paragraph
.
textContent
=
'
Location:
'
;
link
=
document
.
createElement
(
"
a
"
);
link
.
href
=
link
.
textContent
=
window
.
location
.
toString
();
paragraph
.
appendChild
(
link
);
container
.
appendChild
(
paragraph
);
paragraph
=
document
.
createElement
(
"
p
"
);
paragraph
.
textContent
=
'
User-agent:
'
+
navigator
.
userAgent
;
container
.
appendChild
(
paragraph
);
body
.
appendChild
(
container
);
for
(
i
=
0
;
i
<
error_list
.
length
;
i
+=
1
)
{
for
(
i
=
0
;
i
<
error_list
.
length
;
i
+=
1
)
{
error
=
error_list
[
i
];
if
(
error
instanceof
Event
)
{
error
=
{
string
:
error
.
toString
(),
message
:
error
.
message
,
type
:
error
.
type
,
target
:
error
.
target
};
if
(
error
.
target
!==
undefined
)
{
error_list
.
splice
(
i
+
1
,
0
,
error
.
target
);
}
}
if
(
error
instanceof
XMLHttpRequest
)
{
error
=
{
message
:
error
.
toString
(),
readyState
:
error
.
readyState
,
status
:
error
.
status
,
statusText
:
error
.
statusText
,
response
:
error
.
response
,
responseUrl
:
error
.
responseUrl
,
response_headers
:
error
.
getAllResponseHeaders
()
};
}
if
(
error
.
constructor
===
Array
||
error
.
constructor
===
String
||
error
.
constructor
===
Object
)
{
try
{
error
=
JSON
.
stringify
(
error
);
}
catch
(
ignore
)
{
}
}
container
=
document
.
createElement
(
"
section
"
);
container
=
document
.
createElement
(
"
section
"
);
paragraph
=
document
.
createElement
(
"
h2
"
);
paragraph
=
document
.
createElement
(
"
h2
"
);
paragraph
.
textContent
=
error
_list
[
i
].
message
;
paragraph
.
textContent
=
error
.
message
||
error
;
container
.
appendChild
(
paragraph
);
container
.
appendChild
(
paragraph
);
if
(
error
_list
[
i
]
.
fileName
!==
undefined
)
{
if
(
error
.
fileName
!==
undefined
)
{
paragraph
=
document
.
createElement
(
"
p
"
);
paragraph
=
document
.
createElement
(
"
p
"
);
paragraph
.
textContent
=
'
File:
'
+
paragraph
.
textContent
=
'
File:
'
+
error
_list
[
i
]
.
fileName
+
error
.
fileName
+
'
:
'
+
error
_list
[
i
]
.
lineNumber
;
'
:
'
+
error
.
lineNumber
;
container
.
appendChild
(
paragraph
);
container
.
appendChild
(
paragraph
);
}
}
if
(
error
_list
[
i
]
.
stack
!==
undefined
)
{
if
(
error
.
stack
!==
undefined
)
{
paragraph
=
document
.
createElement
(
"
pre
"
);
paragraph
=
document
.
createElement
(
"
pre
"
);
paragraph
.
textContent
=
'
Stack:
'
+
error
_list
[
i
]
.
stack
;
paragraph
.
textContent
=
'
Stack:
'
+
error
.
stack
;
container
.
appendChild
(
paragraph
);
container
.
appendChild
(
paragraph
);
}
}
...
@@ -1421,4 +1468,4 @@
...
@@ -1421,4 +1468,4 @@
bootstrap
();
bootstrap
();
}(
document
,
window
,
RSVP
,
DOMParser
,
Channel
,
MutationObserver
,
Node
,
}(
document
,
window
,
RSVP
,
DOMParser
,
Channel
,
MutationObserver
,
Node
,
FileReader
,
Blob
));
FileReader
,
Blob
,
navigator
,
Event
));
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment