Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
casperjs
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
527b776a
...
527b776a68b47ce52d9e5cf75d8fcff4d22796c2
authored
2012-05-01 11:51:49 +0200
by
Nicolas Perriault
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
added notice for lack of ability to get backtraces from within modules
1 parent
a1c41aef
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
2 deletions
bin/bootstrap.js
bin/bootstrap.js
View file @
527b776
...
...
@@ -206,7 +206,13 @@ phantom.loadCasper = function loadCasper() {
}
var
scriptCode
=
phantom
.
getScriptCode
(
file
);
var
fn
=
new
Function
(
'require'
,
'module'
,
'exports'
,
scriptCode
);
try
{
fn
(
_require
,
module
,
module
.
exports
);
}
catch
(
e
)
{
var
error
=
new
CasperError
(
'__mod_error('
+
path
+
'):: '
+
e
);
error
.
file
=
file
;
throw
error
;
}
requireCache
[
file
]
=
module
;
return
module
.
exports
;
};
...
...
@@ -227,9 +233,18 @@ phantom.loadCasper = function loadCasper() {
*/
phantom
.
onError
=
function
phantom_onError
(
msg
,
backtrace
)
{
var
c
=
require
(
'colorizer'
).
create
();
if
(
msg
)
{
console
.
error
(
c
.
colorize
(
msg
,
'RED_BAR'
,
80
));
var
match
=
/^
(
.*
)
: __mod_error
(
.*
)
::
(
.*
)
/
.
exec
(
msg
);
var
notices
=
[];
if
(
match
&&
match
.
length
===
4
)
{
notices
.
push
(
' in module '
+
match
[
2
]);
notices
.
push
(
' NOTICE: errors within modules cannot be backtraced yet.'
);
cls
=
match
[
1
];
msg
=
match
[
3
];
}
console
.
error
(
c
.
colorize
(
msg
,
'RED_BAR'
,
80
));
notices
.
forEach
(
function
(
notice
)
{
console
.
error
(
c
.
colorize
(
notice
,
'COMMENT'
));
});
backtrace
.
forEach
(
function
(
item
)
{
var
message
=
require
(
'fs'
).
absolute
(
item
.
file
)
+
":"
+
c
.
colorize
(
item
.
line
,
"COMMENT"
);
if
(
item
[
'function'
])
{
...
...
Please
register
or
sign in
to post a comment