FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
js-to-java/lib/exception.js at master · node-modules/js-to-java · GitHub
node-modules
/
js-to-java
Public
Notifications
You must be signed in to change notification settings
Fork
26
Star
201
Code
Issues
5
Pull requests
0
Actions
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Security and quality
Insights
Expand file tree
Breadcrumbs
js-to-java
/
lib
/
exception.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
66 lines (64 loc) · 2.16 KB
Breadcrumbs
js-to-java
/
lib
/
exception.js
Copy path
File metadata and controls
66 lines (64 loc) · 2.16 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
'use strict'
;
module
.
exports
=
function
toException
(
err
,
className
)
{
className
=
className
||
'java.lang.Exception'
;
var
stackTraceElements
=
[
]
;
var
lines
=
err
.
stack
.
match
(
/
a
t
.
+
$
/
gm
)
;
if
(
lines
)
{
// Error: foo
// at repl:1:11
// at REPLServer.defaultEval (repl.js:262:27)
// at bound (domain.js:287:14)
// at REPLServer.runBound [as eval] (domain.js:300:12)
// at REPLServer.<anonymous> (repl.js:431:12)
// at emitOne (events.js:82:20)
// at REPLServer.emit (events.js:169:7)
// at REPLServer.Interface._onLine (readline.js:211:10)
// at REPLServer.Interface._line (readline.js:550:8)
// at REPLServer.Interface._ttyWrite (readline.js:827:14)
for
(
var
line
of
lines
)
{
var
splits
=
line
.
replace
(
' at '
,
''
)
.
split
(
'('
)
;
if
(
splits
.
length
<
2
)
{
splits
.
push
(
splits
[
0
]
)
;
splits
[
0
]
=
'<anonymous>.<anonymous>'
;
}
var
declaring
=
splits
[
0
]
;
var
lastIndexDot
=
declaring
.
lastIndexOf
(
'.'
)
;
var
declaringClass
=
declaring
.
substring
(
0
,
lastIndexDot
)
||
'<unknow>'
;
var
methodName
=
declaring
.
substring
(
lastIndexDot
+
1
)
.
trim
(
)
;
var
fileSplits
=
splits
[
1
]
.
split
(
':'
)
;
var
fileName
=
fileSplits
[
0
]
.
replace
(
')'
,
''
)
;
var
lineNumber
=
parseInt
(
fileSplits
[
1
]
)
||
0
;
// if (isNaN(lineNumber)) {
// // ignore invaild format
// // e.g.: `at next (native)`
// continue;
// }
stackTraceElements
.
push
(
{
'$class'
:
'java.lang.StackTraceElement'
,
'$'
:
{
declaringClass
:
{
'$class'
:
'java.lang.String'
,
'$'
:
declaringClass
}
,
methodName
:
{
'$class'
:
'java.lang.String'
,
'$'
:
methodName
}
,
fileName
:
{
'$class'
:
'java.lang.String'
,
'$'
:
fileName
}
,
lineNumber
:
{
'$class'
:
'int'
,
'$'
:
lineNumber
}
,
}
,
}
)
;
}
}
return
{
'$class'
:
className
,
'$'
:
{
detailMessage
:
{
'$class'
:
'java.lang.String'
,
'$'
:
err
.
name
+
': '
+
err
.
message
,
}
,
stackTrace
:
{
'$class'
:
'[java.lang.StackTraceElement'
,
'$'
:
stackTraceElements
,
}
,
cause
:
{
'$class'
:
'java.lang.Throwable'
,
'$'
:
null
,
}
,
}
,
}
;
}
;
Back
|
FazBrowse Home
|
New Git URL