Skip to content

Commit f56ec3c

Browse files
authored
Merge pull request #52 from atlanhq/ACTIV-571
Fix problem handling response during 500 error
2 parents 7587356 + 7c4fc53 commit f56ec3c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pyatlan/client/atlan.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ def _call_api(
234234

235235
return None
236236
else:
237-
with contextlib.suppress(ValueError):
237+
with contextlib.suppress(ValueError, json.decoder.JSONDecodeError):
238238
error_info = json.loads(response.text)
239239
error_code = error_info.get("errorCode", 0)
240240
error_message = error_info.get("errorMessage", "")
@@ -497,9 +497,11 @@ def create_typedef(self, typedef: TypeDef) -> TypeDefResponse:
497497
)
498498
if isinstance(typedef, ClassificationDef):
499499
from pyatlan.cache.classification_cache import ClassificationCache
500+
500501
ClassificationCache.refresh_cache()
501502
if isinstance(typedef, CustomMetadataDef):
502503
from pyatlan.cache.custom_metadata_cache import CustomMetadataCache
504+
503505
CustomMetadataCache.refresh_cache()
504506
return TypeDefResponse(**raw_json)
505507

@@ -509,6 +511,7 @@ def purge_typedef(self, internal_name: str) -> None:
509511
# to refresh that particular cache
510512
from pyatlan.cache.classification_cache import ClassificationCache
511513
from pyatlan.cache.custom_metadata_cache import CustomMetadataCache
514+
512515
ClassificationCache.refresh_cache()
513516
CustomMetadataCache.refresh_cache()
514517

0 commit comments

Comments
 (0)