song->path, mime_content_type($this->song->path)); (new ResourceServlet($resource))->sendResource($rangeSet); } catch (InvalidRangeHeaderException) { abort(Response::HTTP_BAD_REQUEST); } catch (UnsatisfiableRangeException) { abort(Response::HTTP_REQUESTED_RANGE_NOT_SATISFIABLE); } catch (NonExistentFileException) { abort(Response::HTTP_NOT_FOUND); } catch (UnreadableFileException) { abort(Response::HTTP_INTERNAL_SERVER_ERROR); } catch (SendFileFailureException $e) { abort_unless(headers_sent(), Response::HTTP_INTERNAL_SERVER_ERROR); echo "An error occurred while attempting to send the requested resource: {$e->getMessage()}"; } exit; } }