$apiKey]); } try { app(TmdbApi::class)->browse(); } catch (ClientException $e) { $errResponse = json_decode( $e ->getResponse() ->getBody() ->getContents(), true, 512, JSON_THROW_ON_ERROR, ); return $this->getMessage($errResponse); } } /** * @param array $errResponse * @return array */ private function getMessage($errResponse) { return ['tmdb_api_key' => 'This Themoviedb api key is not valid.']; } }