Add notification for package grammar errors

This commit is contained in:
Kevin Sawicki
2015-03-04 10:51:49 -08:00
parent 49a26ea326
commit 92754bb9a3

View File

@@ -302,7 +302,9 @@ class Package
loadGrammar = (grammarPath, callback) =>
atom.grammars.readGrammar grammarPath, (error, grammar) =>
if error?
console.warn("Failed to load grammar: #{grammarPath}", error.stack ? error)
detail = "#{error.message} in #{grammarPath}"
stack += "#{error.stack}\n at #{grammarPath}:1:1"
atom.notifications.addFatalError("Failed to load a #{@name} package grammar", {stack, detail, dismissable: true})
else
grammar.packageName = @name
@grammars.push(grammar)