Events and exceptions
Use lifecycle events for application integration and exception types for recovery at the boundary that can handle the failure.
Lifecycle events
| Event | Public data | Dispatch point |
|---|---|---|
FeedStartingEvent | feed, target | After storage and path preflight, before converter resolution and staging. |
FeedFinishedEvent | feed, target, path, paths | After every generated file is published successfully. |
$target contains the target key for targeted generation and null for an ordinary feed. FeedFinishedEvent::$paths contains all published paths in order. $path is retained for compatibility and always contains the first path.
Input and lookup failures
| Exception | Meaning |
|---|---|
InvalidFeedArgumentException | A console feed ID is invalid. |
FeedNotFoundException | No registration exists for the requested feed ID. |
InvalidExpressionException | A schedule expression is invalid. |
UnknownFeedClassException | A configured feed class cannot be resolved. |
UnexpectedClassException | A resolved class does not satisfy the expected contract. |
Target selection uses SPL exceptions. When --target is provided, feed:generate throws InvalidArgumentException if no feed registration ID is supplied, a target key is empty, or the selected feed does not implement HasFeedTargets. It throws UnexpectedValueException when findTarget() returns null.
Serialization and storage failures
| Exception | Meaning |
|---|---|
InvalidCsvRowException | A CSV row does not match the established column schema. |
InvalidCsvValueException | A CSV field cannot be serialized as a scalar value. |
InvalidXmlCDataException | A CDATA value is invalid. |
InvalidXmlFragmentException | A raw XML fragment is invalid. |
UnsupportedStorageDiskException | The selected Laravel disk does not resolve to FilesystemAdapter. |
OpenFeedException | A draft output resource cannot be opened. |
WriteFeedException | The full output cannot be written. |
CloseFeedException | The output resource cannot be closed. |
ResourceMetaException | Required stream metadata is unavailable. |
FeedGenerationException | Generation failed for a specific feed class. |
FeedGenerationException::getFeed() returns the feed class. getFeedTarget() returns the target key for targeted generation and null for an ordinary feed. The original failure remains available through getPrevious().
Catch exceptions only where the application can add recovery or user-facing context. Let Laravel report unrecoverable generation failures.