Merge pull request #2536 from github/robertbrignull/throw-instead-of-fail

Throw error instead of using fail method
This commit is contained in:
Robert
2023-06-22 11:48:49 +01:00
committed by GitHub
3 changed files with 3 additions and 7 deletions

View File

@@ -49,7 +49,7 @@ describe("commands declared in package.json", () => {
expect(title).toBeDefined();
commandTitles[command] = title!;
} else {
fail(`Unexpected command name ${command}`);
throw new Error(`Unexpected command name ${command}`);
}
});

View File

@@ -13,7 +13,7 @@ describe("helpers-pure", () => {
try {
await asyncFilter([1, 2, 3], rejects);
fail("Should have thrown");
throw new Error("Should have thrown");
} catch (e) {
expect(getErrorMessage(e)).toBe("opps");
}

View File

@@ -310,11 +310,7 @@ export class DebugController
*/
private async nextEvent(): Promise<AnyDebugEvent> {
if (this.resolver !== undefined) {
const error = new Error(
"Attempt to wait for multiple debugger events at once.",
);
fail(error);
throw error;
throw new Error("Attempt to wait for multiple debugger events at once.");
} else {
if (this.nextEventIndex < this.eventQueue.length) {
// No need to wait.