## Demo: form-errors
### FormErrors.svelte
```svelte
The action throws a plain Error. With {'{@attach enhance(...)}'} the error message is shown inline. Without it, the server renders the Mochi error page.
With {'{@attach enhance(...)}'}
Plain HTML
```
### ErrorDemo.svelte
```svelte
```
### routes.ts
```ts
import { Mochi } from 'mochi-framework';
import type { MochiRouteValue } from 'mochi-framework';
export const routes: Record = {
'/demos/form-errors': Mochi.page('./src/demos/form-errors/FormErrors.svelte', {
actions: {
throwError: () => {
throw new Error('Something went wrong on the server');
},
},
}),
};
```
### index.ts
```ts
import { Mochi, logger } from 'mochi-framework';
await Mochi.serve({
port: 3333,
development: process.env.MODE === 'development',
routes: {
'/': Mochi.page('./src/Home.svelte'),
},
});
logger.info('Server running at http://localhost:3333');
```