Commit e41dc5f5 authored by Timon Gehr's avatar Timon Gehr

Improve error messages.

parent 7d0771f1
Pipeline #4945 passed with stages
in 42 seconds
......@@ -163,7 +163,7 @@ export function deactivate() {}
// }
// let errorMessageClicked = new Promise(async resolve => {
// let answer = await vscode.window.showErrorMessage(
// "Please Choose a name for the new task consisting of alphanumeric symbols",
// "Please choose a name for the new task consisting of alphanumeric symbols",
// "Ok",
// "Cancel"
// );
......
......@@ -40,7 +40,7 @@ export class Runner {
await fs.readFile(compilerPath);
} catch {
vscode.window.showErrorMessage(
"Compiler executable could not be found at it's expected path"
"Compiler executable not found at expected path"
);
return;
}
......@@ -146,7 +146,7 @@ export class Runner {
await fs.readFile(helperPath);
} catch {
vscode.window.showErrorMessage(
"Helper binary could not be found at it's expected path"
"Helper binary not found at expected path"
);
return;
}
......@@ -249,20 +249,20 @@ export class Runner {
let debuggerFlavor = getDebuggerFlavor(this.store);
if (debuggerPath === null) {
vscode.window.showErrorMessage("Debuggerpath could not be determined");
vscode.window.showErrorMessage("Debugger path could not be determined");
return "Failed";
}
try {
await fs.readFile(debuggerPath);
} catch {
vscode.window.showErrorMessage(
"Debugger executable could not be found at it's expected path"
"Debugger executable not found at expected path"
);
return "Failed";
}
if (debuggerFlavor === null) {
vscode.window.showErrorMessage("Couldn't determine the type of debugger");
vscode.window.showErrorMessage("Could not determine type of debugger");
return "Failed";
}
......@@ -295,7 +295,7 @@ export class Runner {
throw err;
} else {
vscode.window.showErrorMessage(
"The binary you try to debug doesn't exist" + err.toString()
"The binary to debug does not exist" + err.toString()
);
}
}
......
......@@ -64,17 +64,17 @@ export async function listSamplesForTaskname(
try {
content = (await fs.readFile(path)).toString();
} catch (err) {
vscode.window.showErrorMessage("Couldn't read soitask file");
throw new Error("Couldn't read soitask file");
vscode.window.showErrorMessage("Cannot read soitask file");
throw new Error("Cannot read soitask file");
}
let sampleList = determineSamples(content);
if (sampleList instanceof StomlError) {
vscode.window.showErrorMessage(
"Couldn't parse soitask. It has the following error: " +
"Cannot parse soitask. It has the following error: " +
sampleList.toString()
);
throw new Error("Couldn't read soitask file");
throw new Error("Cannot read soitask file");
}
return sampleList;
}
......@@ -112,8 +112,8 @@ export async function gotoSample(
sampleName = await selectSample(store, taskname, sampleName);
let sample = store.samples.get(sampleName);
if (sample === undefined) {
vscode.window.showErrorMessage("The selected sample doesn't exist");
throw new Error("The selected sample doesn't exist");
vscode.window.showErrorMessage("The selected sample does not exist");
throw new Error("The selected sample does not exist");
}
let loc = new vscode.Range(
......
......@@ -92,8 +92,8 @@ export async function createCppFile(store: Store, taskname: string) {
preExistingTask !== undefined &&
preExistingTask.solutionFsPath !== null
) {
vscode.window.showErrorMessage("C++ File already exists");
throw new Error("C++ File already exists");
vscode.window.showErrorMessage("C++ file already exists");
throw new Error("C++ file already exists");
}
let workspace = getWorkspaceOrShowError(store).workspaceDir;
try {
......@@ -101,8 +101,8 @@ export async function createCppFile(store: Store, taskname: string) {
store.emitFsChange();
} catch (err) {
vscode.window.showErrorMessage("Couldn't create .cpp file");
throw new Error("Couldn't create .cpp file");
vscode.window.showErrorMessage("Cannot create .cpp file");
throw new Error("Cannot create .cpp file");
}
}
......@@ -118,8 +118,8 @@ export async function createSoitaskFile(store: Store, taskname: string) {
await fs.writeFile(path.join(workspace, taskname + ".soitask"), "");
store.emitFsChange();
} catch (err) {
vscode.window.showErrorMessage("Couldn't create soitask file");
throw new Error("Couldn't create soitaskfile");
vscode.window.showErrorMessage("Cannot create soitask file");
throw new Error("Cannot create soitask file");
}
}
export async function createTask(store: Store) {
......@@ -131,7 +131,7 @@ export async function createTask(store: Store) {
return;
}
if (taskname.length === 0) {
vscode.window.showErrorMessage("A empty taskname doesn't work");
vscode.window.showErrorMessage("Task name cannot be empty");
await createTask(store);
return;
}
......
......@@ -66,7 +66,7 @@ async function determineWorkspaceSettingsFileContent(
}
if (workspaceSettings.length === 0) {
let answer = await vscode.window.showErrorMessage(
"There needs to be a initialized Workspace",
"There needs to be an initialized workspace",
"Initialize now",
"Cancel"
);
......@@ -78,7 +78,7 @@ async function determineWorkspaceSettingsFileContent(
);
} catch (err) {
vscode.window.showErrorMessage(
"Error initializing Workspace: " + err.toString()
"Error initializing workspace: " + err.toString()
);
return null;
}
......@@ -92,7 +92,7 @@ async function determineWorkspaceSettingsFileContent(
)).toString();
} catch (err) {
vscode.window.showErrorMessage(
"Error reading soi workspace settings file" + err.toString()
"Cannot read soi workspace settings file: " + err.toString()
);
return null;
}
......@@ -115,7 +115,7 @@ async function determineWorkspaceSettings(
);
} catch (e) {
vscode.window.showErrorMessage(
"Couldn't parse workspace settings file: " + e.toString()
"Cannot parse workspace settings file: " + e.toString()
);
return null;
}
......
......@@ -44,20 +44,20 @@ export function getSoitaskFilesOfFulltaskOrError(
let workspace = getWorkspaceOrShowError(store);
let soitaskFiles = workspace.task.get(taskname);
if (soitaskFiles === undefined) {
vscode.window.showErrorMessage("The task you are using doesn't exist");
throw new Error("The task you are using doesn't exist");
vscode.window.showErrorMessage("The task you are using does not exist");
throw new Error("The task you are using does not exist");
}
if (soitaskFiles.solutionFsPath === null) {
vscode.window.showErrorMessage(
"The task you are using doesn't have a solution"
"The task you are using does not have a solution file"
);
throw new Error("The task you are using doesn't have a solution");
throw new Error("The task you are using does not have a solution file");
}
if (soitaskFiles.soitaskFsPath === null) {
vscode.window.showErrorMessage(
"The task you are using doesn't have a soitask"
"The task you are using does not have a soitask"
);
throw new Error("The task you are using doesn't have a soitask");
throw new Error("The task you are using does not have a soitask");
}
return soitaskFiles;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment