@@ -655,6 +655,8 @@ public function containerLogsByName(string $name, string $container, array $quer
655655 * @param Closure $callback
656656 * @param array $query
657657 * @return mixed
658+ * @throws \RenokiCo\PhpK8s\Exceptions\KubernetesWatchException
659+ * @throws \RenokiCo\PhpK8s\Exceptions\KubernetesLogsException
658660 */
659661 public function watchLogs (Closure $ callback , array $ query = ['pretty ' => 1 ])
660662 {
@@ -664,6 +666,12 @@ public function watchLogs(Closure $callback, array $query = ['pretty' => 1])
664666 );
665667 }
666668
669+ if (! $ this instanceof Watchable) {
670+ throw new KubernetesLogsException (
671+ 'The resource ' .get_class ($ this ).' does not support watch actions. '
672+ );
673+ }
674+
667675 // Ensure the ?follow=1 query exists to trigger the watch.
668676 $ query = array_merge ($ query , ['follow ' => 1 ]);
669677
@@ -685,6 +693,7 @@ public function watchLogs(Closure $callback, array $query = ['pretty' => 1])
685693 * @param array $query
686694 * @return mixed
687695 * @throws \RenokiCo\PhpK8s\Exceptions\KubernetesWatchException
696+ * @throws \RenokiCo\PhpK8s\Exceptions\KubernetesLogsException
688697 */
689698 public function watchContainerLogs (string $ container , Closure $ callback , array $ query = ['pretty ' => 1 ])
690699 {
@@ -713,6 +722,7 @@ public function watchLogsByName(string $name, Closure $callback, array $query =
713722 * @param array $query
714723 * @return mixed
715724 * @throws \RenokiCo\PhpK8s\Exceptions\KubernetesWatchException
725+ * @throws \RenokiCo\PhpK8s\Exceptions\KubernetesLogsException
716726 */
717727 public function watchContainerLogsByName (string $ name , string $ container , Closure $ callback , array $ query = ['pretty ' => 1 ])
718728 {
0 commit comments