move error from client to shared

pull/14599/head
ComputerGuy 2 years ago
parent 2e656d3fe7
commit b08a4b4817

@ -133,9 +133,3 @@ Reading state that was created inside the same derived is forbidden. Consider us
```
Updating state inside a derived or a template expression is forbidden. If the value should not be reactive, declare it without `$state`
```
### structured_clone_state_proxy
```
To correctly clone a `$state` proxy, use `$state.snapshot` instead of `structuredClone`
```

@ -60,6 +60,12 @@ Certain lifecycle methods can only be used during component initialisation. To f
`%name%` is not a store with a `subscribe` method
```
### structured_clone_state_proxy
```
To correctly clone a `$state` proxy, use `$state.snapshot` instead of `structuredClone`
```
### svelte_element_invalid_this_value
```

@ -87,7 +87,3 @@ See the [migration guide](/docs/svelte/v5-migration-guide#Components-are-no-long
## state_unsafe_mutation
> Updating state inside a derived or a template expression is forbidden. If the value should not be reactive, declare it without `$state`
## structured_clone_state_proxy
> To correctly clone a `$state` proxy, use `$state.snapshot` instead of `structuredClone`

@ -52,6 +52,10 @@ Certain lifecycle methods can only be used during component initialisation. To f
> `%name%` is not a store with a `subscribe` method
## structured_clone_state_proxy
> To correctly clone a `$state` proxy, use `$state.snapshot` instead of `structuredClone`
## svelte_element_invalid_this_value
> The `this` prop on `<svelte:element>` must be a string, if defined

@ -335,19 +335,4 @@ export function state_unsafe_mutation() {
} else {
throw new Error(`https://svelte.dev/e/state_unsafe_mutation`);
}
}
/**
* To correctly clone a `$state` proxy, use `$state.snapshot` instead of `structuredClone`
* @returns {never}
*/
export function structured_clone_state_proxy() {
if (DEV) {
const error = new Error(`structured_clone_state_proxy\nTo correctly clone a \`$state\` proxy, use \`$state.snapshot\` instead of \`structuredClone\`\nhttps://svelte.dev/e/structured_clone_state_proxy`);
error.name = 'Svelte error';
throw error;
} else {
throw new Error(`https://svelte.dev/e/structured_clone_state_proxy`);
}
}

@ -2,7 +2,7 @@
import { DEV } from 'esm-env';
import { STATE_SYMBOL } from '../client/constants.js';
import * as w from './warnings.js';
import * as e from '../client/errors.js';
import * as e from './errors.js';
import {
get_prototype_of,
is_array,

@ -62,4 +62,19 @@ export function svelte_element_invalid_this_value() {
} else {
throw new Error(`https://svelte.dev/e/svelte_element_invalid_this_value`);
}
}
/**
* To correctly clone a `$state` proxy, use `$state.snapshot` instead of `structuredClone`
* @returns {never}
*/
export function structured_clone_state_proxy() {
if (DEV) {
const error = new Error(`structured_clone_state_proxy\nTo correctly clone a \`$state\` proxy, use \`$state.snapshot\` instead of \`structuredClone\`\nhttps://svelte.dev/e/structured_clone_state_proxy`);
error.name = 'Svelte error';
throw error;
} else {
throw new Error(`https://svelte.dev/e/structured_clone_state_proxy`);
}
}
Loading…
Cancel
Save