generated from ditrit/leto-modelizer-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #125 from ditrit/feature/error_management
Feature: error management
- Loading branch information
Showing
19 changed files
with
881 additions
and
612 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import antlr4 from 'antlr4'; | ||
import { ParserLog } from 'leto-modelizer-plugin-core'; | ||
|
||
/** | ||
* Class to manage default error from antlr parser. | ||
*/ | ||
class TerraformErrorListener extends antlr4.error.ErrorListener { | ||
/** | ||
* Default constructor. | ||
* @param {object} pluginData - Plugin data with components | ||
* @param {FileInformation} [file] - File information. | ||
*/ | ||
constructor(pluginData, file) { | ||
super(); | ||
this.pluginData = pluginData; | ||
this.file = file; | ||
} | ||
|
||
syntaxError(recognizer, offendingSymbol, line, column, msg) { | ||
this.pluginData.parseLogs.push(new ParserLog({ | ||
startLineNumber: line, | ||
startColumn: column + 1, | ||
endLineNumber: line, | ||
endColumn: column + offendingSymbol.stop - offendingSymbol.start + 2, | ||
severity: ParserLog.SEVERITY_ERROR, | ||
path: this.file.path, | ||
message: 'terrator-plugin.parser.error.parsing', | ||
initialErrorMessage: msg, | ||
})); | ||
} | ||
} | ||
|
||
export default TerraformErrorListener; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.