Skip to content

Commit 1708850

Browse files
authored
Merge pull request #1109 from atlanhq/FT-859
Improves logging on any CSV decoding errors
2 parents 801810e + dae6a21 commit 1708850

File tree

10 files changed

+13
-13
lines changed

10 files changed

+13
-13
lines changed

package-toolkit/runtime/src/main/kotlin/com/atlan/pkg/serde/cell/CellXformer.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ object CellXformer {
101101
when (type) {
102102
Collection::class.java, List::class.java -> list
103103
Set::class.java, SortedSet::class.java -> TreeSet(list)
104-
else -> throw IOException("Unable to deserialize cell to Java class: $type")
104+
else -> throw IOException("Unable to deserialize cell to Java class (in $fieldName): $type")
105105
}
106106
} else if (Map::class.java.isAssignableFrom(type)) {
107107
TODO("Not yet implemented for import")
@@ -118,7 +118,7 @@ object CellXformer {
118118
// there should be asset references
119119
AssetRefXformer.decode(ctx, value, fieldName)
120120
} else {
121-
throw IOException("Unhandled data type for $fieldName: $type")
121+
throw IOException("Unhandled data type (in $fieldName): $type")
122122
}
123123
}
124124

package-toolkit/runtime/src/main/kotlin/com/atlan/pkg/serde/cell/ConnectionXformer.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ object ConnectionXformer {
6666
return when (fieldName) {
6767
"connection" -> {
6868
ctx.connectionCache.getByIdentity(assetRef)
69-
?: throw NoSuchElementException("Connection $assetRef not found.")
69+
?: throw NoSuchElementException("Connection $assetRef not found (in $fieldName).")
7070
}
7171
else -> AssetRefXformer.decode(ctx, assetRef, fieldName)
7272
}

package-toolkit/runtime/src/main/kotlin/com/atlan/pkg/serde/cell/DataDomainXformer.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ object DataDomainXformer {
5454
return when (fieldName) {
5555
DataDomain.PARENT_DOMAIN.atlanFieldName, DataProduct.DATA_DOMAIN.atlanFieldName -> {
5656
ctx.dataDomainCache.getByIdentity(assetRef)?.trimToReference()
57-
?: throw NoSuchElementException("Domain $assetRef not found.")
57+
?: throw NoSuchElementException("Domain $assetRef not found (in $fieldName).")
5858
}
5959
else -> AssetRefXformer.decode(ctx, assetRef, fieldName)
6060
}

package-toolkit/runtime/src/main/kotlin/com/atlan/pkg/serde/cell/GlossaryCategoryXformer.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ object GlossaryCategoryXformer {
5353
return when (fieldName) {
5454
GlossaryCategory.PARENT_CATEGORY.atlanFieldName -> {
5555
ctx.categoryCache.getByIdentity(assetRef)?.trimToReference()
56-
?: throw NoSuchElementException("Parent category $assetRef not found.")
56+
?: throw NoSuchElementException("Parent category $assetRef not found (in $fieldName).")
5757
}
5858
GlossaryTerm.CATEGORIES.atlanFieldName -> {
5959
ctx.categoryCache.getByIdentity(assetRef)?.trimToReference()
60-
?: throw NoSuchElementException("Category relationship $assetRef not found.")
60+
?: throw NoSuchElementException("Category relationship $assetRef not found (in $fieldName).")
6161
}
6262
else -> AssetRefXformer.decode(ctx, assetRef, fieldName)
6363
}

package-toolkit/runtime/src/main/kotlin/com/atlan/pkg/serde/cell/GlossaryTermXformer.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ object GlossaryTermXformer {
7070
"assignedTerms", in TERM_TO_TERM_FIELDS,
7171
->
7272
ctx.termCache.getByIdentity(assetRef)?.trimToReference()
73-
?: throw NoSuchElementException("Term $assetRef not found (via $fieldName).")
73+
?: throw NoSuchElementException("Term $assetRef not found (in $fieldName).")
7474
else -> AssetRefXformer.decode(ctx, assetRef, fieldName)
7575
}
7676
}

package-toolkit/runtime/src/main/kotlin/com/atlan/pkg/serde/cell/GlossaryXformer.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ object GlossaryXformer {
5353
return when (fieldName) {
5454
GlossaryTerm.ANCHOR.atlanFieldName -> {
5555
ctx.glossaryCache.getByIdentity(assetRef)?.trimToReference()
56-
?: throw NoSuchElementException("Parent glossary $assetRef not found.")
56+
?: throw NoSuchElementException("Parent glossary $assetRef not found (in $fieldName).")
5757
}
5858
else -> AssetRefXformer.decode(ctx, assetRef, fieldName)
5959
}

package-toolkit/runtime/src/main/kotlin/com/atlan/pkg/serde/cell/GroupXformer.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ object GroupXformer {
5353
// And if found by alias, return the group name (since that's what we require)
5454
return client.groupCache.getNameForId(idFromAlias)
5555
} catch (e: NotFoundException) {
56-
throw NoSuchElementException("Group name / alias $groupRef is not known to Atlan.", e)
56+
throw NoSuchElementException("Group name / alias $groupRef is not known to Atlan (in $fieldName).", e)
5757
}
5858
}
5959
}

package-toolkit/runtime/src/main/kotlin/com/atlan/pkg/serde/cell/ModelAssetXformer.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ object ModelAssetXformer {
9393
.semantic(Reference.SaveSemantic.APPEND)
9494
.build()
9595
} else {
96-
throw NoSuchElementException("Model asset $assetRef not found (via $fieldName).")
96+
throw NoSuchElementException("Model asset $assetRef not found (in $fieldName).")
9797
}
9898
}
9999
in MODEL_ASSET_REF_FIELDS -> {
@@ -102,7 +102,7 @@ object ModelAssetXformer {
102102
.semantic(Reference.SaveSemantic.REPLACE)
103103
.build()
104104
} else {
105-
throw NoSuchElementException("Model asset $assetRef not found (via $fieldName).")
105+
throw NoSuchElementException("Model asset $assetRef not found (in $fieldName).")
106106
}
107107
}
108108
else -> AssetRefXformer.decode(ctx, assetRef, fieldName)

package-toolkit/runtime/src/main/kotlin/com/atlan/pkg/serde/cell/RoleXformer.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ object RoleXformer {
4444
// Try to look up the user reference by username
4545
return client.roleCache.getIdForName(roleRef)
4646
} catch (e: NotFoundException) {
47-
throw NoSuchElementException("Role name $roleRef is not known to Atlan.", e)
47+
throw NoSuchElementException("Role name $roleRef is not known to Atlan (in $fieldName).", e)
4848
}
4949
}
5050
else -> roleRef

package-toolkit/runtime/src/main/kotlin/com/atlan/pkg/serde/cell/UserXformer.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ object UserXformer {
5555
// And if found by email, return the username (since that's what we require)
5656
return client.userCache.getNameForId(idFromEmail)
5757
} catch (e: NotFoundException) {
58-
throw NoSuchElementException("Username / email address $userRef is not known to Atlan.", e)
58+
throw NoSuchElementException("Username / email address $userRef is not known to Atlan (in $fieldName).", e)
5959
}
6060
}
6161
}

0 commit comments

Comments
 (0)