Skip to content

Commit fc274ee

Browse files
committed
Name the table in version resolution errors
'failed to determine latest iceberg version: no metadata files found' did not say which table it was looking for, which matters when a query touches several tables or a table name is misspelled.
1 parent dbf136e commit fc274ee

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/metadata.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export function icebergLatestVersion({ tableUrl, resolver, lister }) {
8686
})
8787
})
8888
.catch(err => {
89-
throw new Error(`failed to determine latest iceberg version: ${err.message}`)
89+
throw new Error(`failed to determine latest iceberg version of ${tableUrl}: ${err.message}`)
9090
})
9191
}
9292

@@ -115,7 +115,7 @@ export function icebergListVersions({ tableUrl, resolver, lister }) {
115115
return lister(metadataDir).then(metadataVersions)
116116
})
117117
.catch(err => {
118-
throw new Error(`failed to determine latest iceberg version: ${err.message}`)
118+
throw new Error(`failed to determine latest iceberg version of ${tableUrl}: ${err.message}`)
119119
})
120120
}
121121

test/read.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ describe.concurrent('icebergRead', () => {
1414
})
1515

1616
it('throws for fetch errors', async () => {
17-
// not found
17+
// not found; the error names the table it was looking for
1818
await expect(() => icebergRead({ tableUrl: 'https://hyperparam.app' }))
19-
.rejects.toThrow('failed to determine latest iceberg version')
19+
.rejects.toThrow('failed to determine latest iceberg version of https://hyperparam.app')
2020

2121
// invalid dns
2222
await expect(() => icebergRead({ tableUrl: 'https://nope.hyperparam.app' }))
23-
.rejects.toThrow('failed to determine latest iceberg version')
23+
.rejects.toThrow('failed to determine latest iceberg version of https://nope.hyperparam.app')
2424

2525
// with metadataFileName
2626
await expect(() => icebergRead({

0 commit comments

Comments
 (0)