mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-01 17:57:36 +08:00
DISABLE_THIRD_PARTY_CHECK=NPM update R=jacktfranklin@chromium.org Bug: none Change-Id: I41b7006f336b9465677cc7434abd70a732c58221 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2692907 Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org> Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
47 lines
987 B
JavaScript
47 lines
987 B
JavaScript
'use strict'
|
|
|
|
var VMessage = require('vfile-message')
|
|
var VFile = require('./core.js')
|
|
|
|
module.exports = VFile
|
|
|
|
VFile.prototype.message = message
|
|
VFile.prototype.info = info
|
|
VFile.prototype.fail = fail
|
|
|
|
// Create a message with `reason` at `position`.
|
|
// When an error is passed in as `reason`, copies the stack.
|
|
function message(reason, position, origin) {
|
|
var message = new VMessage(reason, position, origin)
|
|
|
|
if (this.path) {
|
|
message.name = this.path + ':' + message.name
|
|
message.file = this.path
|
|
}
|
|
|
|
message.fatal = false
|
|
|
|
this.messages.push(message)
|
|
|
|
return message
|
|
}
|
|
|
|
// Fail: creates a vmessage, associates it with the file, and throws it.
|
|
function fail() {
|
|
var message = this.message.apply(this, arguments)
|
|
|
|
message.fatal = true
|
|
|
|
throw message
|
|
}
|
|
|
|
// Info: creates a vmessage, associates it with the file, and marks the fatality
|
|
// as null.
|
|
function info() {
|
|
var message = this.message.apply(this, arguments)
|
|
|
|
message.fatal = null
|
|
|
|
return message
|
|
}
|