mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-09 05:08:28 +08:00
This also adds CC-BY-4.0 to the list of accepted licenses. DISABLE_THIRD_PARTY_CHECK=update dependencies Bug: chromium:1083142 Change-Id: I8612de2fba52dae32eeb71af79d5aacfde52142b Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2220097 Reviewed-by: Paul Lewis <aerotwist@chromium.org> Commit-Queue: Mathias Bynens <mathias@chromium.org>
50 lines
1010 B
JavaScript
50 lines
1010 B
JavaScript
'use strict'
|
|
|
|
var VMessage = require('vfile-message')
|
|
var VFile = require('./core.js')
|
|
|
|
module.exports = VFile
|
|
|
|
var proto = VFile.prototype
|
|
|
|
proto.message = message
|
|
proto.info = info
|
|
proto.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 filePath = this.path
|
|
var message = new VMessage(reason, position, origin)
|
|
|
|
if (filePath) {
|
|
message.name = filePath + ':' + message.name
|
|
message.file = filePath
|
|
}
|
|
|
|
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
|
|
}
|