Skip to content

Commit e08b1a8

Browse files
committed
Update build task documentation to include its error handling
1 parent 01955a2 commit e08b1a8

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

docs/advanced-features/build-tasks.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,3 +152,24 @@ class MyServiceProvider extends ServiceProvider
152152
}
153153
}
154154
```
155+
156+
## Error handling
157+
158+
If an exception is thrown in a build task, the build command will catch it and display the error message to the user.
159+
160+
## Helper methods
161+
162+
### Output helpers
163+
164+
When a build task is called by the site build command, it gets access to the Laravel and Symfony console output helpers through the `$output` property.
165+
166+
```php
167+
public function handle(): void
168+
{
169+
/** @var \Illuminate\Console\OutputStyle $output */
170+
171+
$this->output->info('Hello World!');
172+
$this->output->error('Something went wrong!');
173+
$this->output->writeln('This is a line of text');
174+
}
175+
```

0 commit comments

Comments
 (0)