Skip to content

Commit 9e4641b

Browse files
committed
Use createStateError appropriately
These were left out some time ago.
1 parent 90000df commit 9e4641b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/plugin-event-handlers.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ import { memoize } from "./helpers/memoize";
4444

4545
import debug from "./helpers/debug";
4646

47-
import { CypressCucumberError, createError, homepage } from "./helpers/error";
47+
import { CypressCucumberError, homepage } from "./helpers/error";
4848

4949
import { assert, ensure, assertIsString } from "./helpers/assertions";
5050

@@ -251,7 +251,7 @@ export async function beforeRunHandler(config: Cypress.PluginConfigOptions) {
251251
case "uninitialized":
252252
break;
253253
default:
254-
throw createError("Unexpected state in beforeRunHandler: " + state.state);
254+
throw createStateError("beforeRunHandler", state.state);
255255
}
256256

257257
// Copied from https://github.com/cucumber/cucumber-js/blob/v10.0.1/src/cli/helpers.ts#L104-L122.
@@ -331,7 +331,7 @@ export async function afterRunHandler(
331331
case "before-run": // This can happen when running only non-feature specs.
332332
break;
333333
default:
334-
throw createError("Unexpected state in afterRunHandler: " + state.state);
334+
throw createStateError("afterRunHandler", state.state);
335335
}
336336

337337
const testRunFinished: messages.Envelope = {
@@ -575,7 +575,7 @@ export async function afterSpecHandler(
575575
switch (state.state) {
576576
case "uninitialized":
577577
case "after-run":
578-
throw createError("Unexpected state in afterSpecHandler: " + state.state);
578+
throw createStateError("afterSpecHandler", state.state);
579579
}
580580

581581
const browserCrashExprCol = [
@@ -609,7 +609,7 @@ export async function afterSpecHandler(
609609
case "received-envelopes": // This can happen in case of a failing beforeEach hook.
610610
break;
611611
default:
612-
throw createError("Unexpected state in afterSpecHandler: " + state.state);
612+
throw createStateError("afterSpecHandler", state.state);
613613
}
614614

615615
// `results` is undefined when running via `cypress open`.

0 commit comments

Comments
 (0)