Skip to content

Commit 4d5c796

Browse files
committed
chore: fix error message
1 parent eb4c58b commit 4d5c796

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

packages/svelte/src/context.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ const REPLANE_CONTEXT_KEY = Symbol("replane");
88
* Set the Replane client in Svelte context.
99
* @internal
1010
*/
11-
export function setReplaneContext<T extends Record<string, unknown>>(client: ReplaneClient<T>): void {
11+
export function setReplaneContext<T extends Record<string, unknown>>(
12+
client: ReplaneClient<T>
13+
): void {
1214
const value: ReplaneContextValue<T> = { client };
1315
setContext(REPLANE_CONTEXT_KEY, value);
1416
}
@@ -18,10 +20,12 @@ export function setReplaneContext<T extends Record<string, unknown>>(client: Rep
1820
* @internal
1921
*/
2022
// eslint-disable-next-line @typescript-eslint/no-explicit-any
21-
export function getReplaneContext<T extends Record<string, unknown> = any>(): ReplaneContextValue<T> {
23+
export function getReplaneContext<
24+
T extends Record<string, unknown> = any,
25+
>(): ReplaneContextValue<T> {
2226
const context = getContext<ReplaneContextValue<T> | undefined>(REPLANE_CONTEXT_KEY);
2327
if (!context) {
24-
throw new Error("getReplane() must be used within a ReplaneProvider");
28+
throw new Error("getReplane() must be used within a ReplaneContext");
2529
}
2630
return context;
2731
}

packages/svelte/tests/index.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ describe("ReplaneContext with options prop - Client Lifecycle", () => {
299299
describe("getReplane", () => {
300300
it("throws descriptive error when used outside ReplaneProvider", () => {
301301
expect(() => render(TestUseReplaneOutsideProvider)).toThrow(
302-
"getReplane() must be used within a ReplaneProvider"
302+
"getReplane() must be used within a ReplaneContext"
303303
);
304304
});
305305

0 commit comments

Comments
 (0)