Better logging of errors.

sql-parser
Thorsten Muerell 7 years ago
parent 5de17c9079
commit decdbb8f67

@ -58,13 +58,13 @@ export function activate(context: vscode.ExtensionContext) {
try { try {
let json = JSON.parse(outputBuffer); let json = JSON.parse(outputBuffer);
console.log(json);
const diagnostics = []; const diagnostics = [];
let cd = json['columnDefinitions'] let cd = json['columnDefinitions']
if (!json['rows']) { if (!json['rows']) {
if (!json['userErrors']) { if (json['userErrors']) {
myOutputChannel.append("SQL executed successfully.\n");
} else {
myOutputChannel.append("Errors found:\n"); myOutputChannel.append("Errors found:\n");
const document = vscode.window.activeTextEditor.document; const document = vscode.window.activeTextEditor.document;
@ -79,6 +79,10 @@ export function activate(context: vscode.ExtensionContext) {
} }
diagnosticCollection.set(document.uri, diagnostics); diagnosticCollection.set(document.uri, diagnostics);
} else if (json['exception']) {
myOutputChannel.append("Exception caught: " + json['exceptionMessage'] + "\n");
} else {
myOutputChannel.append("SQL executed successfully.\n");
} }
} else { } else {
provider.setData(json); provider.setData(json);

Loading…
Cancel
Save