Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F100643659
CompileError.js
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Feb 1, 10:58
Size
1 KB
Mime Type
text/x-java
Expires
Mon, Feb 3, 10:58 (2 d)
Engine
blob
Format
Raw Data
Handle
24001734
Attached To
rOACCT Open Access Compliance Check Tool (OACCT)
CompileError.js
View Options
import
locate
from
'./locate.js'
;
import
getSnippet
from
'./getSnippet.js'
;
export
default
class
CompileError
extends
Error
{
constructor
(
message
,
node
)
{
super
(
message
);
this
.
name
=
'CompileError'
;
if
(
!
node
)
{
return
;
}
const
source
=
node
.
program
.
magicString
.
original
;
const
loc
=
locate
(
source
,
node
.
start
);
this
.
message
=
message
+
`
(
$
{
loc
.
line
}
:
$
{
loc
.
column
})
`
;
this
.
stack
=
new
Error
().
stack
.
replace
(
new
RegExp
(
`
.
+
new
$
{
this
.
name
}.
+
\\
n
`
,
'm'
),
''
);
this
.
loc
=
loc
;
this
.
snippet
=
getSnippet
(
source
,
loc
,
node
.
end
-
node
.
start
);
}
toString
()
{
return
`
$
{
this
.
name
}
:
$
{
this
.
message
}
\
n$
{
this
.
snippet
}
`
;
}
static
missingTransform
(
feature
,
transformKey
,
node
,
dangerousKey
=
null
)
{
const
maybeDangerous
=
dangerousKey
?
`
,
or
\`
transforms
:
{
$
{
dangerousKey
}
:
true
}
\`
if
you
know
what
you
're doing` : '
'
;
throw
new
CompileError
(
`
Transforming
$
{
feature
}
is
not
$
{
dangerousKey
?
"fully supported"
:
"implemented"
}.
Use
\`
transforms
:
{
$
{
transformKey
}
:
false
}
\`
to
skip
transformation
and
disable
this
error$
{
maybeDangerous
}.
`
,
node
);
}
}
Event Timeline
Log In to Comment