1111
1212from pydantic .v1 import Field , StrictStr , validator
1313
14+ from pyatlan .errors import ErrorCode
1415from pyatlan .model .data_mesh import DataProductsAssetsDSL
1516from pyatlan .model .enums import (
1617 DataProductCriticality ,
@@ -129,6 +130,7 @@ def get_assets(self, client: Optional[AtlanClient] = None):
129130
130131 :param client: connectivity to an Atlan tenant (optional). If not provided, the default client will be used.
131132
133+ :raises NotFoundError: if DataProduct asset DSL cannot be found (does not exist) in Atlan
132134 :raises AtlanError: if there is an issue interacting with the API
133135 :returns: instance of `IndexSearchResults` with list of all assets linked to the provided data product
134136
@@ -137,9 +139,12 @@ def get_assets(self, client: Optional[AtlanClient] = None):
137139
138140 client = AtlanClient .get_current_client () if not client else client
139141 dp_dsl = self .data_product_assets_d_s_l
140- json_object = json .loads (dp_dsl ) if dp_dsl else {}
141- request = IndexSearchRequest (** json_object .get ("query" , {}))
142- response = client .asset .search (request )
142+ if dp_dsl :
143+ json_object = json .loads (dp_dsl ) if dp_dsl else {}
144+ request = IndexSearchRequest (** json_object .get ("query" , {}))
145+ response = client .asset .search (request )
146+ else :
147+ raise ErrorCode .MISSING_DP_Asset_DSL .exception_with_parameters ()
143148 return response
144149
145150 type_name : str = Field (default = "DataProduct" , allow_mutation = False )
0 commit comments