Commit 89d66558 authored by caleb tucker-raymond's avatar caleb tucker-raymond Committed by Joseph Olstad
Browse files

Issue #3198823 by calebtr, JKingsnorth, cboyden:...

Issue #3198823 by calebtr, JKingsnorth, cboyden: MediaInternetYouTubeHandler::validId() throws exception that is not handled by calling methods
parent 9991b773
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -125,8 +125,17 @@ class MediaInternetYouTubeHandler extends MediaInternetBaseHandler {
        throw new MediaInternetValidationException("The YouTube video ID is invalid, video was deleted or is disabled for embedding. Error: {$error_data}");
      }
    }
    elseif ($response->code == 401) {
      $message = t("There was an error, please check the video settings. Embedding, and playback on other websites, may have been disabled by the video owner. (Error: @code, @error)", ['@code' => $response->code, '@error' => $response->error]);
      throw new MediaInternetValidationException($message);
    }
    elseif ($response->code == 403) {
      $message = t("There was an error, please check the video settings. The video may be private, disabled or unavailable. (Error: @code, @error)", ['@code' => $response->code, '@error' => $response->error]);
      throw new MediaInternetValidationException($message);
    }
    else {
      throw new Exception("Error Processing Request. (Error: {$response->code}, {$response->error})");
      $message = t("There was an error with this YouTube video. Please check the URL and video settings and try again. (Error: @code, @error)", ['@code' => $response->code, '@error' => $response->error]);
      throw new MediaInternetValidationException($message);
    }
  }
}