diff --git a/Classes/Controller/YoutubeController.php b/Classes/Controller/YoutubeController.php
index 23d81ea83d099599229f7a8adef69c9afaea0c86..a056354303fcb2a1f5f27651fe659e9c1390b234 100644
--- a/Classes/Controller/YoutubeController.php
+++ b/Classes/Controller/YoutubeController.php
@@ -172,9 +172,9 @@ class YoutubeController extends ActionController {
 				return $this->returnNoVideosFoundResponse($debugOutput);
 			}
 
-			throw $exception;
+			return $this->displayException($exception);
 		} catch (Exception $exception) {
-			return $this->htmlResponse('<div style="color: red;">' . $exception->getMessage() . '</div>');
+			return $this->displayException($exception);
 		}
 
 		if (count($jsonArray['items']) < 1) {
@@ -362,4 +362,14 @@ class YoutubeController extends ActionController {
 		);
 		return $this->htmlResponse();
 	}
+
+	/**
+	 * Displays an error message and exception
+	 *
+	 * @param InvalidArgumentException|Exception $exception
+	 * @return ResponseInterface
+	 */
+	public function displayException(InvalidArgumentException|Exception $exception): ResponseInterface {
+		return $this->htmlResponse('<div style="color: red;">' . $exception->getMessage() . '</div>');
+	}
 }