diff --git a/src/index.js b/src/index.js index 0859b41..069a960 100644 --- a/src/index.js +++ b/src/index.js @@ -70,7 +70,7 @@ function svrouter() { if (typeof realCallback !== "function") { throw new Error("The passed callback must be a function."); } else if (callback && typeof path !== "string") { - throw new Error("The path must be a function"); + throw new Error("The path must be a string."); } const realPath = callback ? path.replace(/\/+$/, "") : ""; diff --git a/tests/index.test.js b/tests/index.test.js index 02f0529..13b4d87 100644 --- a/tests/index.test.js +++ b/tests/index.test.js @@ -216,7 +216,7 @@ describe("SVRouter", () => { test("should throw an error if path is not a string in passRoute", () => { expect(() => { router.pass(123, () => {}); - }).toThrow("The path must be a function"); + }).toThrow("The path must be a string."); }); test("should handle errors thrown in route callbacks gracefully", () => {