Direct resolver and manager calls throw package exceptions. The HTTP surface catches those exceptions and converts them to HTTP responses.
AssetExceptionis the base package exception.AssetNotFoundExceptionmeans no registered root contained the requested file.InvalidAssetPathExceptionmeans the virtual path, root, manifest entry, or URL shape is invalid.UnreadableAssetExceptionmeans a resolved asset cannot be read.AssetResponseExceptionmeans the asset was resolved but the response body could not be created.
<?php
use CommonPHP\Assets\Exceptions\AssetNotFoundException;
try {
$asset = $assets->resolve('missing.css');
} catch (AssetNotFoundException) {
// Application-specific fallback.
}<?php
$response = $assetSurface->handle($request);The surface returns simple text responses for failures. Applications that need custom error pages can wrap the surface or call the manager directly from their own controller.
Invalid paths are treated as client errors. The package avoids echoing the rejected path into HTTP responses so traversal attempts and malformed input are not reflected back to users.