Skip to content

Commit

Permalink
Minor
Browse files Browse the repository at this point in the history
  • Loading branch information
yesamer committed Dec 17, 2024
1 parent 223e14d commit bb98575
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,7 @@ export function activate(context: vscode.ExtensionContext) {

kieFilesWatcher.subscribeKieFilesClosed(() => {
console.debug(
"[Extended Services Extension] A KIE file has been closed. Current opened KIE files: " +
kieFilesWatcher.watchedKieFiles.length
`[Extended Services Extension] A KIE file has been closed. Current opened KIE files: ${kieFilesWatcher.watchedKieFiles.length}`
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ function startExtendedServices(context: vscode.ExtensionContext): void {
try {
configuration = fetchConfiguration();
} catch (error) {
console.error("[Extended Services Extension] Extension configuration is wrong: " + error.message);
console.error(`[Extended Services Extension] Extension configuration is wrong: ${error.message}`);
vscode.window.showErrorMessage(
"Extension configuration is wrong: " + error.message + " Please fix your local extension's setting"
`Extension configuration is wrong: ${error.message}. Please fix your local extension's setting.`
);
statusBarItem.hide();
return;
Expand Down Expand Up @@ -113,27 +113,26 @@ function startLocalExtendedServices(configuration: Configuration, context: vscod
} catch (error) {
stopExtendedServices(configuration);
console.error(
"[Extended Services Extension] An error happened while trying to start the Local Extended Services process:" +
error.message
`[Extended Services Extension] An error happened while trying to start the Local Extended Services process: ${error.message}`
);
vscode.window.showErrorMessage(
"An error happened while trying to start the Local Extended Services process:" + error.message
`An error happened while trying to start the Local Extended Services process: ${error.message}`
);
}
}

function startConnection(configuration: Configuration) {
console.debug(
"[Extended Services Extension] Connecting with the Extended Services located: " + configuration.extendedServicesURL
`[Extended Services Extension] Connecting with the Extended Services located: ${configuration.extendedServicesURL}`
);
try {
connection.start(configuration.extendedServicesURL, configuration.connectionHeartbeatIntervalInSecs);
} catch (error) {
stopExtendedServices(configuration);
console.error(
"[Extended Services Extension] An error happened while trying to connect to the service:" + error.message
`[Extended Services Extension] An error happened while trying to connect to the service: ${error.message}`
);
vscode.window.showErrorMessage("An error happened while trying to connect to the service:" + error.message);
vscode.window.showErrorMessage(`An error happened while trying to connect to the service: ${error.message}`);
}
}

Expand All @@ -147,36 +146,30 @@ async function validate(extendedServicesURL: URL) {

for (const bpmnFile of bpmnFiles) {
try {
console.debug("[Extended Services Extension] Validating BPMN file: " + bpmnFile.uri.path);
console.debug(`[Extended Services Extension] Validating BPMN file: ${bpmnFile.uri.path}`);
const bpmnDiagnostics: vscode.Diagnostic[] = await validator.validateBPMN(extendedServicesURL, bpmnFile);
diagnosticCollection.set(bpmnFile.uri, bpmnDiagnostics);
} catch (error) {
console.error(
"[Extended Services Extension] An error happened while trying to validate " +
bpmnFile.uri.path +
": " +
error.message
`[Extended Services Extension] An error happened while trying to validate ${bpmnFile.uri.path}: ${error.message}`
);
vscode.window.showErrorMessage(
"An error happened while trying to validate " + bpmnFile.uri.path + ": " + error.message
`An error happened while trying to validate ${bpmnFile.uri.path}: ${error.message}`
);
}
}

for (const dmnFile of dmnFiles) {
try {
console.debug("[Extended Services Extension] Validating DMN file: " + dmnFile.uri.path);
console.debug(`[Extended Services Extension] Validating DMN file: ${dmnFile.uri.path}`);
const dmnDiagnostics: vscode.Diagnostic[] = await validator.validateDMN(extendedServicesURL, dmnFile);
diagnosticCollection.set(dmnFile.uri, dmnDiagnostics);
} catch (error) {
console.error(
"[Extended Services Extension] An error happened while trying to validate " +
dmnFile.uri.path +
": " +
error.message
`[Extended Services Extension] An error happened while trying to validate ${dmnFile.uri.path}: ${error.message}`
);
vscode.window.showErrorMessage(
"An error happened while trying to validate " + dmnFile.uri.path + ": " + error.message
`An error happened while trying to validate ${dmnFile.uri.path}: ${error.message}`
);
}
}
Expand All @@ -197,8 +190,9 @@ export function activate(context: vscode.ExtensionContext) {

kieFilesWatcher.subscribeKieFilesOpened(() => {
console.debug(
"[Extended Services Extension] A KIE file has been opened. Current opened KIE files: " +
`[Extended Services Extension] A KIE file has been opened. Current opened KIE files: ${
kieFilesWatcher.watchedKieFiles.length
}`
);
if (!disconnectedByUser && isConnected && configuration) {
validate(configuration.extendedServicesURL);
Expand All @@ -217,8 +211,7 @@ export function activate(context: vscode.ExtensionContext) {

kieFilesWatcher.subscribeKieFilesClosed(() => {
console.debug(
"[Extended Services Extension] A KIE file has been closed. Current opened KIE files: " +
kieFilesWatcher.watchedKieFiles.length
`[Extended Services Extension] A KIE file has been closed. Current opened KIE files: ${kieFilesWatcher.watchedKieFiles.length}`
);
});

Expand Down Expand Up @@ -261,7 +254,7 @@ export function activate(context: vscode.ExtensionContext) {
stopExtendedServices(configuration);
isConnected = false;
console.error("[Extended Services Extension] Connection lost with Extended Services");
vscode.window.showErrorMessage("Connection error: " + errorMessage);
vscode.window.showErrorMessage(`Connection error: ${errorMessage}`);
});

connection.subscribeDisconnected(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ async function validate(
textDocument = await vscode.workspace.openTextDocument(kieFile.uri);
}
const url = new URL(endpoint, serviceURL);
console.debug("[Extended Services Extension] Fetching " + url.toString());
console.debug(`[Extended Services Extension] Fetching ${url.toString()}`);
const response = await fetch(url.toString(), {
method: "POST",
headers: {
Expand All @@ -75,12 +75,7 @@ export async function validateBPMN(
return validate(serviceURL, bpmnFile, "/jitbpmn/validate", validationresponse.parseBPMNValidationResponse);
} catch (error) {
console.error(
"[Extended Services Extension] An error happened while trying to validate " +
bpmnFile +
" from serviceUrl " +
serviceURL +
": " +
error
`[Extended Services Extension] An error happened while trying to validate ${bpmnFile} from serviceUrl ${serviceURL}: ${error.message}`
);
throw new Error("VALIDATE BPMN REQUEST ERROR: \n", error.message);
}
Expand All @@ -94,12 +89,7 @@ export async function validateDMN(
return validate(serviceURL, dmnFile, "/jitdmn/validate", validationresponse.parseDMNValidationResponse);
} catch (error) {
console.error(
"[Extended Services Extension] An error happened while trying to validate " +
dmnFile +
" from serviceUrl " +
serviceURL +
": " +
error
`[Extended Services Extension] An error happened while trying to validate ${dmnFile} from serviceUrl ${serviceURL}: ${error.message}`
);
throw new Error("VALIDATE DMN REQUEST ERROR: \n", error.message);
}
Expand Down

0 comments on commit bb98575

Please sign in to comment.