Skip to content

Commit 2688c86

Browse files
authored
fix: include resource type in IcebergMaximumResourceLimit error message (#1207)
1 parent ed246d2 commit 2688c86

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/internal/errors/codes.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,11 @@ export const ERRORS = {
7272
message: `The bucket you tried to delete is not empty`,
7373
originalError: e,
7474
}),
75-
IcebergMaximumResourceLimit: (limit: number, e?: Error) =>
75+
IcebergMaximumResourceLimit: (resource: string, limit: number, e?: Error) =>
7676
new StorageBackendError({
7777
code: ErrorCode.IcebergMaximumResourceLimit,
7878
httpStatusCode: 409,
79-
message: `The maximum number of this resource ${limit} is reached`,
79+
message: `The maximum number of this resource (${resource}) ${limit} is reached`,
8080
originalError: e,
8181
}),
8282
IcebergResourceNotEmpty: (resource: string, name: string, e?: Error) =>

src/storage/protocols/iceberg/catalog/tenant-catalog.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ export class TenantAwareRestCatalog extends RestCatalogClient {
155155
})
156156

157157
if (catalogCount >= this.options.limits.maxCatalogsCount) {
158-
throw ERRORS.IcebergMaximumResourceLimit(this.options.limits.maxCatalogsCount)
158+
throw ERRORS.IcebergMaximumResourceLimit('catalog', this.options.limits.maxCatalogsCount)
159159
}
160160

161161
return store.assignCatalog({
@@ -215,7 +215,7 @@ export class TenantAwareRestCatalog extends RestCatalogClient {
215215
})
216216

217217
if (tableCount >= this.options.limits.maxTableCount) {
218-
throw ERRORS.IcebergMaximumResourceLimit(this.options.limits.maxTableCount)
218+
throw ERRORS.IcebergMaximumResourceLimit('table', this.options.limits.maxTableCount)
219219
}
220220

221221
const namespaceName = this.getTenantNamespaceName(dbNamespace.id)
@@ -481,7 +481,7 @@ export class TenantAwareRestCatalog extends RestCatalogClient {
481481
})
482482

483483
if (namespaceCount >= this.options.limits.maxNamespaceCount) {
484-
throw ERRORS.IcebergMaximumResourceLimit(this.options.limits.maxNamespaceCount)
484+
throw ERRORS.IcebergMaximumResourceLimit('namespace', this.options.limits.maxNamespaceCount)
485485
}
486486

487487
const catalog = await store.findCatalogByName({

0 commit comments

Comments
 (0)