Skip to main content

Events and exceptions

Use lifecycle events for application integration and exception types for recovery at the boundary that can handle the failure.

Lifecycle events

EventPublic dataDispatch point
FeedStartingEventfeed, targetAfter storage and path preflight, before converter resolution and staging.
FeedFinishedEventfeed, target, path, pathsAfter 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

ExceptionMeaning
InvalidFeedArgumentExceptionA console feed ID is invalid.
FeedNotFoundExceptionNo registration exists for the requested feed ID.
InvalidExpressionExceptionA schedule expression is invalid.
UnknownFeedClassExceptionA configured feed class cannot be resolved.
UnexpectedClassExceptionA 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

ExceptionMeaning
InvalidCsvRowExceptionA CSV row does not match the established column schema.
InvalidCsvValueExceptionA CSV field cannot be serialized as a scalar value.
InvalidXmlCDataExceptionA CDATA value is invalid.
InvalidXmlFragmentExceptionA raw XML fragment is invalid.
UnsupportedStorageDiskExceptionThe selected Laravel disk does not resolve to FilesystemAdapter.
OpenFeedExceptionA draft output resource cannot be opened.
WriteFeedExceptionThe full output cannot be written.
CloseFeedExceptionThe output resource cannot be closed.
ResourceMetaExceptionRequired stream metadata is unavailable.
FeedGenerationExceptionGeneration 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.

See Also