From edc682a943af92a23583188dbcb06bec4dbf3275 Mon Sep 17 00:00:00 2001 From: Christopher Grote Date: Mon, 20 Jan 2025 11:41:27 +0000 Subject: [PATCH] Standardize error messages for log parsing Signed-off-by: Christopher Grote --- .../main/kotlin/com/atlan/pkg/serde/cell/ConnectionXformer.kt | 2 +- .../main/kotlin/com/atlan/pkg/serde/cell/DataDomainXformer.kt | 2 +- .../src/main/kotlin/com/atlan/pkg/serde/cell/EnumXformer.kt | 2 +- .../com/atlan/pkg/serde/cell/GlossaryCategoryXformer.kt | 4 ++-- .../kotlin/com/atlan/pkg/serde/cell/GlossaryTermXformer.kt | 2 +- .../main/kotlin/com/atlan/pkg/serde/cell/GlossaryXformer.kt | 2 +- .../src/main/kotlin/com/atlan/pkg/serde/cell/GroupXformer.kt | 2 +- .../main/kotlin/com/atlan/pkg/serde/cell/ModelAssetXformer.kt | 4 ++-- .../src/main/kotlin/com/atlan/pkg/serde/cell/RoleXformer.kt | 2 +- .../src/main/kotlin/com/atlan/pkg/serde/cell/UserXformer.kt | 2 +- 10 files changed, 12 insertions(+), 12 deletions(-) diff --git a/package-toolkit/runtime/src/main/kotlin/com/atlan/pkg/serde/cell/ConnectionXformer.kt b/package-toolkit/runtime/src/main/kotlin/com/atlan/pkg/serde/cell/ConnectionXformer.kt index fc223e81ab..cbfb3ed715 100644 --- a/package-toolkit/runtime/src/main/kotlin/com/atlan/pkg/serde/cell/ConnectionXformer.kt +++ b/package-toolkit/runtime/src/main/kotlin/com/atlan/pkg/serde/cell/ConnectionXformer.kt @@ -64,7 +64,7 @@ object ConnectionXformer { when (fieldName) { "connection" -> { ctx.connectionCache.getByIdentity(assetRef) - ?: throw NoSuchElementException("Connection $assetRef not found (in $fieldName).") + ?: throw NoSuchElementException("Connection not found (in $fieldName): $assetRef") } else -> AssetRefXformer.decode(ctx, assetRef, fieldName) } diff --git a/package-toolkit/runtime/src/main/kotlin/com/atlan/pkg/serde/cell/DataDomainXformer.kt b/package-toolkit/runtime/src/main/kotlin/com/atlan/pkg/serde/cell/DataDomainXformer.kt index ff2d1e9de7..4055e879e8 100644 --- a/package-toolkit/runtime/src/main/kotlin/com/atlan/pkg/serde/cell/DataDomainXformer.kt +++ b/package-toolkit/runtime/src/main/kotlin/com/atlan/pkg/serde/cell/DataDomainXformer.kt @@ -53,7 +53,7 @@ object DataDomainXformer { when (fieldName) { DataDomain.PARENT_DOMAIN.atlanFieldName, DataProduct.DATA_DOMAIN.atlanFieldName -> { ctx.dataDomainCache.getByIdentity(assetRef)?.trimToReference() - ?: throw NoSuchElementException("Domain $assetRef not found (in $fieldName).") + ?: throw NoSuchElementException("Domain not found (in $fieldName): $assetRef") } else -> AssetRefXformer.decode(ctx, assetRef, fieldName) } diff --git a/package-toolkit/runtime/src/main/kotlin/com/atlan/pkg/serde/cell/EnumXformer.kt b/package-toolkit/runtime/src/main/kotlin/com/atlan/pkg/serde/cell/EnumXformer.kt index 875e810b09..9e15c0afbe 100644 --- a/package-toolkit/runtime/src/main/kotlin/com/atlan/pkg/serde/cell/EnumXformer.kt +++ b/package-toolkit/runtime/src/main/kotlin/com/atlan/pkg/serde/cell/EnumXformer.kt @@ -15,7 +15,7 @@ object EnumXformer { val method = enumClass.getMethod("fromValue", String::class.java) val result: Any? = method.invoke(null, enum) if (result == null) { - throw IllegalArgumentException("$enumClass (in field $fieldName) does not have any matching value for: $enum") + throw IllegalArgumentException("No matching value found for $enumClass (in field $fieldName): $enum") } else { return result as AtlanEnum } diff --git a/package-toolkit/runtime/src/main/kotlin/com/atlan/pkg/serde/cell/GlossaryCategoryXformer.kt b/package-toolkit/runtime/src/main/kotlin/com/atlan/pkg/serde/cell/GlossaryCategoryXformer.kt index 3a6e2e658e..5e7abcc4bc 100644 --- a/package-toolkit/runtime/src/main/kotlin/com/atlan/pkg/serde/cell/GlossaryCategoryXformer.kt +++ b/package-toolkit/runtime/src/main/kotlin/com/atlan/pkg/serde/cell/GlossaryCategoryXformer.kt @@ -52,11 +52,11 @@ object GlossaryCategoryXformer { when (fieldName) { GlossaryCategory.PARENT_CATEGORY.atlanFieldName -> { ctx.categoryCache.getByIdentity(assetRef)?.trimToReference() - ?: throw NoSuchElementException("Parent category $assetRef not found (in $fieldName).") + ?: throw NoSuchElementException("Parent category not found (in $fieldName): $assetRef") } GlossaryTerm.CATEGORIES.atlanFieldName -> { ctx.categoryCache.getByIdentity(assetRef)?.trimToReference() - ?: throw NoSuchElementException("Category relationship $assetRef not found (in $fieldName).") + ?: throw NoSuchElementException("Category relationship not found (in $fieldName): $assetRef") } else -> AssetRefXformer.decode(ctx, assetRef, fieldName) } diff --git a/package-toolkit/runtime/src/main/kotlin/com/atlan/pkg/serde/cell/GlossaryTermXformer.kt b/package-toolkit/runtime/src/main/kotlin/com/atlan/pkg/serde/cell/GlossaryTermXformer.kt index f701feaed7..925410a999 100644 --- a/package-toolkit/runtime/src/main/kotlin/com/atlan/pkg/serde/cell/GlossaryTermXformer.kt +++ b/package-toolkit/runtime/src/main/kotlin/com/atlan/pkg/serde/cell/GlossaryTermXformer.kt @@ -70,7 +70,7 @@ object GlossaryTermXformer { "assignedTerms", in TERM_TO_TERM_FIELDS, -> ctx.termCache.getByIdentity(assetRef)?.trimToReference() - ?: throw NoSuchElementException("Term $assetRef not found (in $fieldName).") + ?: throw NoSuchElementException("Term not found (in $fieldName): $assetRef") else -> AssetRefXformer.decode(ctx, assetRef, fieldName) } } diff --git a/package-toolkit/runtime/src/main/kotlin/com/atlan/pkg/serde/cell/GlossaryXformer.kt b/package-toolkit/runtime/src/main/kotlin/com/atlan/pkg/serde/cell/GlossaryXformer.kt index 9a56e6a0de..bceefd7d68 100644 --- a/package-toolkit/runtime/src/main/kotlin/com/atlan/pkg/serde/cell/GlossaryXformer.kt +++ b/package-toolkit/runtime/src/main/kotlin/com/atlan/pkg/serde/cell/GlossaryXformer.kt @@ -52,7 +52,7 @@ object GlossaryXformer { when (fieldName) { GlossaryTerm.ANCHOR.atlanFieldName -> { ctx.glossaryCache.getByIdentity(assetRef)?.trimToReference() - ?: throw NoSuchElementException("Parent glossary $assetRef not found (in $fieldName).") + ?: throw NoSuchElementException("Parent glossary not found (in $fieldName): $assetRef") } else -> AssetRefXformer.decode(ctx, assetRef, fieldName) } diff --git a/package-toolkit/runtime/src/main/kotlin/com/atlan/pkg/serde/cell/GroupXformer.kt b/package-toolkit/runtime/src/main/kotlin/com/atlan/pkg/serde/cell/GroupXformer.kt index 7dff2237de..677293b646 100644 --- a/package-toolkit/runtime/src/main/kotlin/com/atlan/pkg/serde/cell/GroupXformer.kt +++ b/package-toolkit/runtime/src/main/kotlin/com/atlan/pkg/serde/cell/GroupXformer.kt @@ -51,7 +51,7 @@ object GroupXformer { // And if found by alias, return the group name (since that's what we require) return client.groupCache.getNameForId(idFromAlias) } catch (e: NotFoundException) { - throw NoSuchElementException("Group name / alias $groupRef is not known to Atlan (in $fieldName).", e) + throw NoSuchElementException("Group name / alias is not known to Atlan (in $fieldName): $groupRef", e) } } } diff --git a/package-toolkit/runtime/src/main/kotlin/com/atlan/pkg/serde/cell/ModelAssetXformer.kt b/package-toolkit/runtime/src/main/kotlin/com/atlan/pkg/serde/cell/ModelAssetXformer.kt index dfa09f10c3..e1259c4c5d 100644 --- a/package-toolkit/runtime/src/main/kotlin/com/atlan/pkg/serde/cell/ModelAssetXformer.kt +++ b/package-toolkit/runtime/src/main/kotlin/com/atlan/pkg/serde/cell/ModelAssetXformer.kt @@ -93,7 +93,7 @@ object ModelAssetXformer { .semantic(Reference.SaveSemantic.APPEND) .build() } else { - throw NoSuchElementException("Model asset $assetRef not found (in $fieldName).") + throw NoSuchElementException("Model asset not found (in $fieldName): $assetRef") } } in MODEL_ASSET_REF_FIELDS -> { @@ -102,7 +102,7 @@ object ModelAssetXformer { .semantic(Reference.SaveSemantic.REPLACE) .build() } else { - throw NoSuchElementException("Model asset $assetRef not found (in $fieldName).") + throw NoSuchElementException("Model asset not found (in $fieldName): $assetRef") } } else -> AssetRefXformer.decode(ctx, assetRef, fieldName) diff --git a/package-toolkit/runtime/src/main/kotlin/com/atlan/pkg/serde/cell/RoleXformer.kt b/package-toolkit/runtime/src/main/kotlin/com/atlan/pkg/serde/cell/RoleXformer.kt index 00f70bfdc4..d7fbe0927d 100644 --- a/package-toolkit/runtime/src/main/kotlin/com/atlan/pkg/serde/cell/RoleXformer.kt +++ b/package-toolkit/runtime/src/main/kotlin/com/atlan/pkg/serde/cell/RoleXformer.kt @@ -42,7 +42,7 @@ object RoleXformer { // Try to look up the user reference by username return client.roleCache.getIdForName(roleRef) } catch (e: NotFoundException) { - throw NoSuchElementException("Role name $roleRef is not known to Atlan (in $fieldName).", e) + throw NoSuchElementException("Role name is not known to Atlan (in $fieldName): $roleRef", e) } } else -> roleRef diff --git a/package-toolkit/runtime/src/main/kotlin/com/atlan/pkg/serde/cell/UserXformer.kt b/package-toolkit/runtime/src/main/kotlin/com/atlan/pkg/serde/cell/UserXformer.kt index 983687544a..322a012e03 100644 --- a/package-toolkit/runtime/src/main/kotlin/com/atlan/pkg/serde/cell/UserXformer.kt +++ b/package-toolkit/runtime/src/main/kotlin/com/atlan/pkg/serde/cell/UserXformer.kt @@ -53,7 +53,7 @@ object UserXformer { // And if found by email, return the username (since that's what we require) return client.userCache.getNameForId(idFromEmail) } catch (e: NotFoundException) { - throw NoSuchElementException("Username / email address $userRef is not known to Atlan (in $fieldName).", e) + throw NoSuchElementException("Username / email address is not known to Atlan (in $fieldName): $userRef", e) } } }