@@ -464,7 +464,7 @@ def _get_url(
464464 return url
465465
466466 def __resolve_page_name_and_display_name_file_path (
467- self , page : str
467+ self , page : str , return_error : bool = True
468468 ) -> Tuple [str , str , str ]:
469469
470470 self ._ensure_pbir ()
@@ -486,19 +486,25 @@ def __resolve_page_name_and_display_name_file_path(
486486 elif page in name_lookup :
487487 path , page_id = name_lookup [page ]
488488 return path , page_id , page
489- else :
489+ elif return_error :
490490 raise ValueError (
491491 f"{ icons .red_dot } Invalid page display name. The '{ page } ' page does not exist in the '{ self ._report_name } ' report within the '{ self ._workspace_name } ' workspace."
492492 )
493+ else :
494+ return (None , page , page )
493495
494- def _resolve_page_name_and_display_name (self , page : str ) -> Tuple [str , str ]:
496+ def _resolve_page_name_and_display_name (
497+ self , page : str , return_error : bool = True
498+ ) -> Tuple [str , str ]:
495499 """
496500 Obtains the page name, page display name for a given page in a report.
497501
498502 Parameters
499503 ----------
500504 page : str
501505 The page name or display name.
506+ return_error : bool, default=True
507+ Whether to raise an error if the page does not exist.
502508
503509 Returns
504510 -------
@@ -507,7 +513,8 @@ def _resolve_page_name_and_display_name(self, page: str) -> Tuple[str, str]:
507513 """
508514
509515 (_ , page_id , page_name ) = self .__resolve_page_name_and_display_name_file_path (
510- page
516+ page ,
517+ return_error = return_error ,
511518 )
512519
513520 return (page_id , page_name )
@@ -1757,7 +1764,7 @@ def list_bookmarks(self) -> pd.DataFrame:
17571764 "applyOnlyToTargetVisuals" , False
17581765 )
17591766 (page_id , page_display ) = self ._resolve_page_name_and_display_name (
1760- rpt_page_id
1767+ page = rpt_page_id , return_error = False
17611768 )
17621769
17631770 for rptPg in payload .get ("explorationState" , {}).get ("sections" , {}):
0 commit comments