diff --git a/docs/src/spec.yaml b/docs/src/spec.yaml index a2651db9e..03f94a569 100644 --- a/docs/src/spec.yaml +++ b/docs/src/spec.yaml @@ -2399,6 +2399,9 @@ components: 18 - Internal: Unexpected server/implementation error 19 - InvalidTableState: Table is in an invalid state for the operation 20 - TableSchemaValidationError: Table schema validation failed + 21 - Throttling: Request rate limit exceeded + 22 - TableBranchNotFound: The specified table branch does not exist + 23 - TableBranchAlreadyExists: A table branch with this name already exists example: 4 detail: type: string diff --git a/java/lance-namespace-apache-client/api/openapi.yaml b/java/lance-namespace-apache-client/api/openapi.yaml index cef929f7e..0be97375e 100644 --- a/java/lance-namespace-apache-client/api/openapi.yaml +++ b/java/lance-namespace-apache-client/api/openapi.yaml @@ -3278,6 +3278,9 @@ components: 18 - Internal: Unexpected server/implementation error 19 - InvalidTableState: Table is in an invalid state for the operation 20 - TableSchemaValidationError: Table schema validation failed + 21 - Throttling: Request rate limit exceeded + 22 - TableBranchNotFound: The specified table branch does not exist + 23 - TableBranchAlreadyExists: A table branch with this name already exists example: 4 minimum: 0 type: integer diff --git a/java/lance-namespace-apache-client/docs/ErrorResponse.md b/java/lance-namespace-apache-client/docs/ErrorResponse.md index 944224ca7..0e197fc8b 100644 --- a/java/lance-namespace-apache-client/docs/ErrorResponse.md +++ b/java/lance-namespace-apache-client/docs/ErrorResponse.md @@ -9,7 +9,7 @@ Common JSON error response model | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| |**error** | **String** | A brief, human-readable message about the error. | [optional] | -|**code** | **Integer** | Lance Namespace error code identifying the error type. Error codes: 0 - Unsupported: Operation not supported by this backend 1 - NamespaceNotFound: The specified namespace does not exist 2 - NamespaceAlreadyExists: A namespace with this name already exists 3 - NamespaceNotEmpty: Namespace contains tables or child namespaces 4 - TableNotFound: The specified table does not exist 5 - TableAlreadyExists: A table with this name already exists 6 - TableIndexNotFound: The specified table index does not exist 7 - TableIndexAlreadyExists: A table index with this name already exists 8 - TableTagNotFound: The specified table tag does not exist 9 - TableTagAlreadyExists: A table tag with this name already exists 10 - TransactionNotFound: The specified transaction does not exist 11 - TableVersionNotFound: The specified table version does not exist 12 - TableColumnNotFound: The specified table field does not exist 13 - InvalidInput: Malformed request or invalid parameters 14 - ConcurrentModification: Optimistic concurrency conflict 15 - PermissionDenied: User lacks permission for this operation 16 - Unauthenticated: Authentication credentials are missing or invalid 17 - ServiceUnavailable: Service is temporarily unavailable 18 - Internal: Unexpected server/implementation error 19 - InvalidTableState: Table is in an invalid state for the operation 20 - TableSchemaValidationError: Table schema validation failed | | +|**code** | **Integer** | Lance Namespace error code identifying the error type. Error codes: 0 - Unsupported: Operation not supported by this backend 1 - NamespaceNotFound: The specified namespace does not exist 2 - NamespaceAlreadyExists: A namespace with this name already exists 3 - NamespaceNotEmpty: Namespace contains tables or child namespaces 4 - TableNotFound: The specified table does not exist 5 - TableAlreadyExists: A table with this name already exists 6 - TableIndexNotFound: The specified table index does not exist 7 - TableIndexAlreadyExists: A table index with this name already exists 8 - TableTagNotFound: The specified table tag does not exist 9 - TableTagAlreadyExists: A table tag with this name already exists 10 - TransactionNotFound: The specified transaction does not exist 11 - TableVersionNotFound: The specified table version does not exist 12 - TableColumnNotFound: The specified table field does not exist 13 - InvalidInput: Malformed request or invalid parameters 14 - ConcurrentModification: Optimistic concurrency conflict 15 - PermissionDenied: User lacks permission for this operation 16 - Unauthenticated: Authentication credentials are missing or invalid 17 - ServiceUnavailable: Service is temporarily unavailable 18 - Internal: Unexpected server/implementation error 19 - InvalidTableState: Table is in an invalid state for the operation 20 - TableSchemaValidationError: Table schema validation failed 21 - Throttling: Request rate limit exceeded 22 - TableBranchNotFound: The specified table branch does not exist 23 - TableBranchAlreadyExists: A table branch with this name already exists | | |**detail** | **String** | An optional human-readable explanation of the error. This can be used to record additional information such as stack trace. | [optional] | |**instance** | **String** | A string that identifies the specific occurrence of the error. This can be a URI, a request or response ID, or anything that the implementation can recognize to trace specific occurrence of the error. | [optional] | diff --git a/java/lance-namespace-apache-client/src/main/java/org/lance/namespace/model/ErrorResponse.java b/java/lance-namespace-apache-client/src/main/java/org/lance/namespace/model/ErrorResponse.java index d2d9473ca..143f1064a 100644 --- a/java/lance-namespace-apache-client/src/main/java/org/lance/namespace/model/ErrorResponse.java +++ b/java/lance-namespace-apache-client/src/main/java/org/lance/namespace/model/ErrorResponse.java @@ -93,7 +93,9 @@ public ErrorResponse code(@javax.annotation.Nonnull Integer code) { * Unauthenticated: Authentication credentials are missing or invalid 17 - ServiceUnavailable: * Service is temporarily unavailable 18 - Internal: Unexpected server/implementation error 19 - * InvalidTableState: Table is in an invalid state for the operation 20 - - * TableSchemaValidationError: Table schema validation failed minimum: 0 + * TableSchemaValidationError: Table schema validation failed 21 - Throttling: Request rate limit + * exceeded 22 - TableBranchNotFound: The specified table branch does not exist 23 - + * TableBranchAlreadyExists: A table branch with this name already exists minimum: 0 * * @return code */ diff --git a/java/lance-namespace-async-client/api/openapi.yaml b/java/lance-namespace-async-client/api/openapi.yaml index cef929f7e..0be97375e 100644 --- a/java/lance-namespace-async-client/api/openapi.yaml +++ b/java/lance-namespace-async-client/api/openapi.yaml @@ -3278,6 +3278,9 @@ components: 18 - Internal: Unexpected server/implementation error 19 - InvalidTableState: Table is in an invalid state for the operation 20 - TableSchemaValidationError: Table schema validation failed + 21 - Throttling: Request rate limit exceeded + 22 - TableBranchNotFound: The specified table branch does not exist + 23 - TableBranchAlreadyExists: A table branch with this name already exists example: 4 minimum: 0 type: integer diff --git a/java/lance-namespace-async-client/docs/ErrorResponse.md b/java/lance-namespace-async-client/docs/ErrorResponse.md index 944224ca7..0e197fc8b 100644 --- a/java/lance-namespace-async-client/docs/ErrorResponse.md +++ b/java/lance-namespace-async-client/docs/ErrorResponse.md @@ -9,7 +9,7 @@ Common JSON error response model | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| |**error** | **String** | A brief, human-readable message about the error. | [optional] | -|**code** | **Integer** | Lance Namespace error code identifying the error type. Error codes: 0 - Unsupported: Operation not supported by this backend 1 - NamespaceNotFound: The specified namespace does not exist 2 - NamespaceAlreadyExists: A namespace with this name already exists 3 - NamespaceNotEmpty: Namespace contains tables or child namespaces 4 - TableNotFound: The specified table does not exist 5 - TableAlreadyExists: A table with this name already exists 6 - TableIndexNotFound: The specified table index does not exist 7 - TableIndexAlreadyExists: A table index with this name already exists 8 - TableTagNotFound: The specified table tag does not exist 9 - TableTagAlreadyExists: A table tag with this name already exists 10 - TransactionNotFound: The specified transaction does not exist 11 - TableVersionNotFound: The specified table version does not exist 12 - TableColumnNotFound: The specified table field does not exist 13 - InvalidInput: Malformed request or invalid parameters 14 - ConcurrentModification: Optimistic concurrency conflict 15 - PermissionDenied: User lacks permission for this operation 16 - Unauthenticated: Authentication credentials are missing or invalid 17 - ServiceUnavailable: Service is temporarily unavailable 18 - Internal: Unexpected server/implementation error 19 - InvalidTableState: Table is in an invalid state for the operation 20 - TableSchemaValidationError: Table schema validation failed | | +|**code** | **Integer** | Lance Namespace error code identifying the error type. Error codes: 0 - Unsupported: Operation not supported by this backend 1 - NamespaceNotFound: The specified namespace does not exist 2 - NamespaceAlreadyExists: A namespace with this name already exists 3 - NamespaceNotEmpty: Namespace contains tables or child namespaces 4 - TableNotFound: The specified table does not exist 5 - TableAlreadyExists: A table with this name already exists 6 - TableIndexNotFound: The specified table index does not exist 7 - TableIndexAlreadyExists: A table index with this name already exists 8 - TableTagNotFound: The specified table tag does not exist 9 - TableTagAlreadyExists: A table tag with this name already exists 10 - TransactionNotFound: The specified transaction does not exist 11 - TableVersionNotFound: The specified table version does not exist 12 - TableColumnNotFound: The specified table field does not exist 13 - InvalidInput: Malformed request or invalid parameters 14 - ConcurrentModification: Optimistic concurrency conflict 15 - PermissionDenied: User lacks permission for this operation 16 - Unauthenticated: Authentication credentials are missing or invalid 17 - ServiceUnavailable: Service is temporarily unavailable 18 - Internal: Unexpected server/implementation error 19 - InvalidTableState: Table is in an invalid state for the operation 20 - TableSchemaValidationError: Table schema validation failed 21 - Throttling: Request rate limit exceeded 22 - TableBranchNotFound: The specified table branch does not exist 23 - TableBranchAlreadyExists: A table branch with this name already exists | | |**detail** | **String** | An optional human-readable explanation of the error. This can be used to record additional information such as stack trace. | [optional] | |**instance** | **String** | A string that identifies the specific occurrence of the error. This can be a URI, a request or response ID, or anything that the implementation can recognize to trace specific occurrence of the error. | [optional] | diff --git a/java/lance-namespace-async-client/src/main/java/org/lance/namespace/model/ErrorResponse.java b/java/lance-namespace-async-client/src/main/java/org/lance/namespace/model/ErrorResponse.java index 08807fbc4..a220ae829 100644 --- a/java/lance-namespace-async-client/src/main/java/org/lance/namespace/model/ErrorResponse.java +++ b/java/lance-namespace-async-client/src/main/java/org/lance/namespace/model/ErrorResponse.java @@ -91,7 +91,9 @@ public ErrorResponse code(@javax.annotation.Nonnull Integer code) { * Unauthenticated: Authentication credentials are missing or invalid 17 - ServiceUnavailable: * Service is temporarily unavailable 18 - Internal: Unexpected server/implementation error 19 - * InvalidTableState: Table is in an invalid state for the operation 20 - - * TableSchemaValidationError: Table schema validation failed minimum: 0 + * TableSchemaValidationError: Table schema validation failed 21 - Throttling: Request rate limit + * exceeded 22 - TableBranchNotFound: The specified table branch does not exist 23 - + * TableBranchAlreadyExists: A table branch with this name already exists minimum: 0 * * @return code */ diff --git a/java/lance-namespace-core-async/src/main/java/org/lance/namespace/async/errors/ErrorCode.java b/java/lance-namespace-core-async/src/main/java/org/lance/namespace/async/errors/ErrorCode.java index d9447e271..4db3813a9 100644 --- a/java/lance-namespace-core-async/src/main/java/org/lance/namespace/async/errors/ErrorCode.java +++ b/java/lance-namespace-core-async/src/main/java/org/lance/namespace/async/errors/ErrorCode.java @@ -40,7 +40,9 @@ public enum ErrorCode { INTERNAL(18, "Internal error"), INVALID_TABLE_STATE(19, "Invalid table state"), TABLE_SCHEMA_VALIDATION_ERROR(20, "Table schema validation error"), - THROTTLING(21, "Request rate limit exceeded"); + THROTTLING(21, "Request rate limit exceeded"), + TABLE_BRANCH_NOT_FOUND(22, "Table branch not found"), + TABLE_BRANCH_ALREADY_EXISTS(23, "Table branch already exists"); private final int code; private final String description; diff --git a/java/lance-namespace-core-async/src/main/java/org/lance/namespace/async/errors/ErrorFactory.java b/java/lance-namespace-core-async/src/main/java/org/lance/namespace/async/errors/ErrorFactory.java index 11b0c410e..51bc43b10 100644 --- a/java/lance-namespace-core-async/src/main/java/org/lance/namespace/async/errors/ErrorFactory.java +++ b/java/lance-namespace-core-async/src/main/java/org/lance/namespace/async/errors/ErrorFactory.java @@ -92,6 +92,10 @@ public static LanceNamespaceException fromErrorCode( return new TableSchemaValidationException(message, detail, instance); case THROTTLING: return new ThrottlingException(message, detail, instance); + case TABLE_BRANCH_NOT_FOUND: + return new TableBranchNotFoundException(message, detail, instance); + case TABLE_BRANCH_ALREADY_EXISTS: + return new TableBranchAlreadyExistsException(message, detail, instance); default: return new InternalException(message, detail, instance); } diff --git a/java/lance-namespace-core-async/src/main/java/org/lance/namespace/async/errors/TableBranchAlreadyExistsException.java b/java/lance-namespace-core-async/src/main/java/org/lance/namespace/async/errors/TableBranchAlreadyExistsException.java new file mode 100644 index 000000000..53cdb25ff --- /dev/null +++ b/java/lance-namespace-core-async/src/main/java/org/lance/namespace/async/errors/TableBranchAlreadyExistsException.java @@ -0,0 +1,32 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.lance.namespace.async.errors; + +import javax.annotation.Nullable; + +/** Thrown when a table branch with the specified name already exists. */ +public class TableBranchAlreadyExistsException extends LanceNamespaceException { + public TableBranchAlreadyExistsException(String message) { + super(ErrorCode.TABLE_BRANCH_ALREADY_EXISTS, message); + } + + public TableBranchAlreadyExistsException(String message, Throwable cause) { + super(ErrorCode.TABLE_BRANCH_ALREADY_EXISTS, message, cause); + } + + public TableBranchAlreadyExistsException( + String message, @Nullable String detail, @Nullable String instance) { + super(ErrorCode.TABLE_BRANCH_ALREADY_EXISTS, message, detail, instance); + } +} diff --git a/java/lance-namespace-core-async/src/main/java/org/lance/namespace/async/errors/TableBranchNotFoundException.java b/java/lance-namespace-core-async/src/main/java/org/lance/namespace/async/errors/TableBranchNotFoundException.java new file mode 100644 index 000000000..da78c3d91 --- /dev/null +++ b/java/lance-namespace-core-async/src/main/java/org/lance/namespace/async/errors/TableBranchNotFoundException.java @@ -0,0 +1,32 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.lance.namespace.async.errors; + +import javax.annotation.Nullable; + +/** Thrown when the specified table branch does not exist. */ +public class TableBranchNotFoundException extends LanceNamespaceException { + public TableBranchNotFoundException(String message) { + super(ErrorCode.TABLE_BRANCH_NOT_FOUND, message); + } + + public TableBranchNotFoundException(String message, Throwable cause) { + super(ErrorCode.TABLE_BRANCH_NOT_FOUND, message, cause); + } + + public TableBranchNotFoundException( + String message, @Nullable String detail, @Nullable String instance) { + super(ErrorCode.TABLE_BRANCH_NOT_FOUND, message, detail, instance); + } +} diff --git a/java/lance-namespace-core/src/main/java/org/lance/namespace/errors/ErrorCode.java b/java/lance-namespace-core/src/main/java/org/lance/namespace/errors/ErrorCode.java index 646b0e97a..f51893f82 100644 --- a/java/lance-namespace-core/src/main/java/org/lance/namespace/errors/ErrorCode.java +++ b/java/lance-namespace-core/src/main/java/org/lance/namespace/errors/ErrorCode.java @@ -40,7 +40,9 @@ public enum ErrorCode { INTERNAL(18, "Internal error"), INVALID_TABLE_STATE(19, "Invalid table state"), TABLE_SCHEMA_VALIDATION_ERROR(20, "Table schema validation error"), - THROTTLING(21, "Request rate limit exceeded"); + THROTTLING(21, "Request rate limit exceeded"), + TABLE_BRANCH_NOT_FOUND(22, "Table branch not found"), + TABLE_BRANCH_ALREADY_EXISTS(23, "Table branch already exists"); private final int code; private final String description; diff --git a/java/lance-namespace-core/src/main/java/org/lance/namespace/errors/ErrorFactory.java b/java/lance-namespace-core/src/main/java/org/lance/namespace/errors/ErrorFactory.java index 1b286c93f..32fedb791 100644 --- a/java/lance-namespace-core/src/main/java/org/lance/namespace/errors/ErrorFactory.java +++ b/java/lance-namespace-core/src/main/java/org/lance/namespace/errors/ErrorFactory.java @@ -92,6 +92,10 @@ public static LanceNamespaceException fromErrorCode( return new TableSchemaValidationException(message, detail, instance); case THROTTLING: return new ThrottlingException(message, detail, instance); + case TABLE_BRANCH_NOT_FOUND: + return new TableBranchNotFoundException(message, detail, instance); + case TABLE_BRANCH_ALREADY_EXISTS: + return new TableBranchAlreadyExistsException(message, detail, instance); default: return new InternalException(message, detail, instance); } diff --git a/java/lance-namespace-core/src/main/java/org/lance/namespace/errors/TableBranchAlreadyExistsException.java b/java/lance-namespace-core/src/main/java/org/lance/namespace/errors/TableBranchAlreadyExistsException.java new file mode 100644 index 000000000..a1bde8284 --- /dev/null +++ b/java/lance-namespace-core/src/main/java/org/lance/namespace/errors/TableBranchAlreadyExistsException.java @@ -0,0 +1,32 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.lance.namespace.errors; + +import javax.annotation.Nullable; + +/** Thrown when a table branch with the specified name already exists. */ +public class TableBranchAlreadyExistsException extends LanceNamespaceException { + public TableBranchAlreadyExistsException(String message) { + super(ErrorCode.TABLE_BRANCH_ALREADY_EXISTS, message); + } + + public TableBranchAlreadyExistsException(String message, Throwable cause) { + super(ErrorCode.TABLE_BRANCH_ALREADY_EXISTS, message, cause); + } + + public TableBranchAlreadyExistsException( + String message, @Nullable String detail, @Nullable String instance) { + super(ErrorCode.TABLE_BRANCH_ALREADY_EXISTS, message, detail, instance); + } +} diff --git a/java/lance-namespace-core/src/main/java/org/lance/namespace/errors/TableBranchNotFoundException.java b/java/lance-namespace-core/src/main/java/org/lance/namespace/errors/TableBranchNotFoundException.java new file mode 100644 index 000000000..656429316 --- /dev/null +++ b/java/lance-namespace-core/src/main/java/org/lance/namespace/errors/TableBranchNotFoundException.java @@ -0,0 +1,32 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.lance.namespace.errors; + +import javax.annotation.Nullable; + +/** Thrown when the specified table branch does not exist. */ +public class TableBranchNotFoundException extends LanceNamespaceException { + public TableBranchNotFoundException(String message) { + super(ErrorCode.TABLE_BRANCH_NOT_FOUND, message); + } + + public TableBranchNotFoundException(String message, Throwable cause) { + super(ErrorCode.TABLE_BRANCH_NOT_FOUND, message, cause); + } + + public TableBranchNotFoundException( + String message, @Nullable String detail, @Nullable String instance) { + super(ErrorCode.TABLE_BRANCH_NOT_FOUND, message, detail, instance); + } +} diff --git a/java/lance-namespace-springboot-server/src/main/java/org/lance/namespace/server/springboot/model/ErrorResponse.java b/java/lance-namespace-springboot-server/src/main/java/org/lance/namespace/server/springboot/model/ErrorResponse.java index 52b26ab7e..a66382ad0 100644 --- a/java/lance-namespace-springboot-server/src/main/java/org/lance/namespace/server/springboot/model/ErrorResponse.java +++ b/java/lance-namespace-springboot-server/src/main/java/org/lance/namespace/server/springboot/model/ErrorResponse.java @@ -90,7 +90,9 @@ public ErrorResponse code(Integer code) { * Unauthenticated: Authentication credentials are missing or invalid 17 - ServiceUnavailable: * Service is temporarily unavailable 18 - Internal: Unexpected server/implementation error 19 - * InvalidTableState: Table is in an invalid state for the operation 20 - - * TableSchemaValidationError: Table schema validation failed minimum: 0 + * TableSchemaValidationError: Table schema validation failed 21 - Throttling: Request rate limit + * exceeded 22 - TableBranchNotFound: The specified table branch does not exist 23 - + * TableBranchAlreadyExists: A table branch with this name already exists minimum: 0 * * @return code */ @@ -100,7 +102,7 @@ public ErrorResponse code(Integer code) { name = "code", example = "4", description = - "Lance Namespace error code identifying the error type. Error codes: 0 - Unsupported: Operation not supported by this backend 1 - NamespaceNotFound: The specified namespace does not exist 2 - NamespaceAlreadyExists: A namespace with this name already exists 3 - NamespaceNotEmpty: Namespace contains tables or child namespaces 4 - TableNotFound: The specified table does not exist 5 - TableAlreadyExists: A table with this name already exists 6 - TableIndexNotFound: The specified table index does not exist 7 - TableIndexAlreadyExists: A table index with this name already exists 8 - TableTagNotFound: The specified table tag does not exist 9 - TableTagAlreadyExists: A table tag with this name already exists 10 - TransactionNotFound: The specified transaction does not exist 11 - TableVersionNotFound: The specified table version does not exist 12 - TableColumnNotFound: The specified table field does not exist 13 - InvalidInput: Malformed request or invalid parameters 14 - ConcurrentModification: Optimistic concurrency conflict 15 - PermissionDenied: User lacks permission for this operation 16 - Unauthenticated: Authentication credentials are missing or invalid 17 - ServiceUnavailable: Service is temporarily unavailable 18 - Internal: Unexpected server/implementation error 19 - InvalidTableState: Table is in an invalid state for the operation 20 - TableSchemaValidationError: Table schema validation failed ", + "Lance Namespace error code identifying the error type. Error codes: 0 - Unsupported: Operation not supported by this backend 1 - NamespaceNotFound: The specified namespace does not exist 2 - NamespaceAlreadyExists: A namespace with this name already exists 3 - NamespaceNotEmpty: Namespace contains tables or child namespaces 4 - TableNotFound: The specified table does not exist 5 - TableAlreadyExists: A table with this name already exists 6 - TableIndexNotFound: The specified table index does not exist 7 - TableIndexAlreadyExists: A table index with this name already exists 8 - TableTagNotFound: The specified table tag does not exist 9 - TableTagAlreadyExists: A table tag with this name already exists 10 - TransactionNotFound: The specified transaction does not exist 11 - TableVersionNotFound: The specified table version does not exist 12 - TableColumnNotFound: The specified table field does not exist 13 - InvalidInput: Malformed request or invalid parameters 14 - ConcurrentModification: Optimistic concurrency conflict 15 - PermissionDenied: User lacks permission for this operation 16 - Unauthenticated: Authentication credentials are missing or invalid 17 - ServiceUnavailable: Service is temporarily unavailable 18 - Internal: Unexpected server/implementation error 19 - InvalidTableState: Table is in an invalid state for the operation 20 - TableSchemaValidationError: Table schema validation failed 21 - Throttling: Request rate limit exceeded 22 - TableBranchNotFound: The specified table branch does not exist 23 - TableBranchAlreadyExists: A table branch with this name already exists ", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("code") public Integer getCode() { diff --git a/python/lance_namespace/lance_namespace/__init__.py b/python/lance_namespace/lance_namespace/__init__.py index 91ccfc93d..914151615 100644 --- a/python/lance_namespace/lance_namespace/__init__.py +++ b/python/lance_namespace/lance_namespace/__init__.py @@ -54,6 +54,8 @@ InvalidTableStateError, TableSchemaValidationError, ThrottlingError, + TableBranchNotFoundError, + TableBranchAlreadyExistsError, from_error_code, ) @@ -204,6 +206,8 @@ "InvalidTableStateError", "TableSchemaValidationError", "ThrottlingError", + "TableBranchNotFoundError", + "TableBranchAlreadyExistsError", "from_error_code", # Request/Response types (re-exported from lance_namespace_urllib3_client) "AlterTableAddColumnsRequest", diff --git a/python/lance_namespace/lance_namespace/errors.py b/python/lance_namespace/lance_namespace/errors.py index 220ee42ab..cf200194f 100644 --- a/python/lance_namespace/lance_namespace/errors.py +++ b/python/lance_namespace/lance_namespace/errors.py @@ -68,6 +68,8 @@ class ErrorCode(IntEnum): INVALID_TABLE_STATE = 19 TABLE_SCHEMA_VALIDATION_ERROR = 20 THROTTLING = 21 + TABLE_BRANCH_NOT_FOUND = 22 + TABLE_BRANCH_ALREADY_EXISTS = 23 class LanceNamespaceError(Exception): @@ -217,6 +219,18 @@ class ThrottlingError(LanceNamespaceError): code = ErrorCode.THROTTLING +class TableBranchNotFoundError(LanceNamespaceError): + """Raised when the specified table branch does not exist.""" + + code = ErrorCode.TABLE_BRANCH_NOT_FOUND + + +class TableBranchAlreadyExistsError(LanceNamespaceError): + """Raised when a table branch with the specified name already exists.""" + + code = ErrorCode.TABLE_BRANCH_ALREADY_EXISTS + + # Mapping from error code to exception class _ERROR_CODE_TO_EXCEPTION: Dict[ErrorCode, Type[LanceNamespaceError]] = { ErrorCode.UNSUPPORTED: UnsupportedOperationError, @@ -241,6 +255,8 @@ class ThrottlingError(LanceNamespaceError): ErrorCode.INVALID_TABLE_STATE: InvalidTableStateError, ErrorCode.TABLE_SCHEMA_VALIDATION_ERROR: TableSchemaValidationError, ErrorCode.THROTTLING: ThrottlingError, + ErrorCode.TABLE_BRANCH_NOT_FOUND: TableBranchNotFoundError, + ErrorCode.TABLE_BRANCH_ALREADY_EXISTS: TableBranchAlreadyExistsError, } diff --git a/python/lance_namespace/lance_namespace/tests/test_namespace.py b/python/lance_namespace/lance_namespace/tests/test_namespace.py index 56af745b9..28a2ea032 100644 --- a/python/lance_namespace/lance_namespace/tests/test_namespace.py +++ b/python/lance_namespace/lance_namespace/tests/test_namespace.py @@ -175,3 +175,23 @@ class NotANamespace: def __init__(self, **properties): pass + + +class TestErrorCodes: + """Error code round trips for programmatic handling.""" + + def test_branch_error_codes_round_trip(self): + from lance_namespace import ( + ErrorCode, + TableBranchAlreadyExistsError, + TableBranchNotFoundError, + from_error_code, + ) + + err = from_error_code(22, "branch missing") + assert isinstance(err, TableBranchNotFoundError) + assert err.code == ErrorCode.TABLE_BRANCH_NOT_FOUND + + err = from_error_code(23, "branch exists") + assert isinstance(err, TableBranchAlreadyExistsError) + assert err.code == ErrorCode.TABLE_BRANCH_ALREADY_EXISTS diff --git a/python/lance_namespace_urllib3_client/docs/ErrorResponse.md b/python/lance_namespace_urllib3_client/docs/ErrorResponse.md index 9fe30a977..c8884ad16 100644 --- a/python/lance_namespace_urllib3_client/docs/ErrorResponse.md +++ b/python/lance_namespace_urllib3_client/docs/ErrorResponse.md @@ -7,7 +7,7 @@ Common JSON error response model Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **error** | **str** | A brief, human-readable message about the error. | [optional] -**code** | **int** | Lance Namespace error code identifying the error type. Error codes: 0 - Unsupported: Operation not supported by this backend 1 - NamespaceNotFound: The specified namespace does not exist 2 - NamespaceAlreadyExists: A namespace with this name already exists 3 - NamespaceNotEmpty: Namespace contains tables or child namespaces 4 - TableNotFound: The specified table does not exist 5 - TableAlreadyExists: A table with this name already exists 6 - TableIndexNotFound: The specified table index does not exist 7 - TableIndexAlreadyExists: A table index with this name already exists 8 - TableTagNotFound: The specified table tag does not exist 9 - TableTagAlreadyExists: A table tag with this name already exists 10 - TransactionNotFound: The specified transaction does not exist 11 - TableVersionNotFound: The specified table version does not exist 12 - TableColumnNotFound: The specified table field does not exist 13 - InvalidInput: Malformed request or invalid parameters 14 - ConcurrentModification: Optimistic concurrency conflict 15 - PermissionDenied: User lacks permission for this operation 16 - Unauthenticated: Authentication credentials are missing or invalid 17 - ServiceUnavailable: Service is temporarily unavailable 18 - Internal: Unexpected server/implementation error 19 - InvalidTableState: Table is in an invalid state for the operation 20 - TableSchemaValidationError: Table schema validation failed | +**code** | **int** | Lance Namespace error code identifying the error type. Error codes: 0 - Unsupported: Operation not supported by this backend 1 - NamespaceNotFound: The specified namespace does not exist 2 - NamespaceAlreadyExists: A namespace with this name already exists 3 - NamespaceNotEmpty: Namespace contains tables or child namespaces 4 - TableNotFound: The specified table does not exist 5 - TableAlreadyExists: A table with this name already exists 6 - TableIndexNotFound: The specified table index does not exist 7 - TableIndexAlreadyExists: A table index with this name already exists 8 - TableTagNotFound: The specified table tag does not exist 9 - TableTagAlreadyExists: A table tag with this name already exists 10 - TransactionNotFound: The specified transaction does not exist 11 - TableVersionNotFound: The specified table version does not exist 12 - TableColumnNotFound: The specified table field does not exist 13 - InvalidInput: Malformed request or invalid parameters 14 - ConcurrentModification: Optimistic concurrency conflict 15 - PermissionDenied: User lacks permission for this operation 16 - Unauthenticated: Authentication credentials are missing or invalid 17 - ServiceUnavailable: Service is temporarily unavailable 18 - Internal: Unexpected server/implementation error 19 - InvalidTableState: Table is in an invalid state for the operation 20 - TableSchemaValidationError: Table schema validation failed 21 - Throttling: Request rate limit exceeded 22 - TableBranchNotFound: The specified table branch does not exist 23 - TableBranchAlreadyExists: A table branch with this name already exists | **detail** | **str** | An optional human-readable explanation of the error. This can be used to record additional information such as stack trace. | [optional] **instance** | **str** | A string that identifies the specific occurrence of the error. This can be a URI, a request or response ID, or anything that the implementation can recognize to trace specific occurrence of the error. | [optional] diff --git a/python/lance_namespace_urllib3_client/lance_namespace_urllib3_client/models/error_response.py b/python/lance_namespace_urllib3_client/lance_namespace_urllib3_client/models/error_response.py index b5f9d4f15..20f79a620 100644 --- a/python/lance_namespace_urllib3_client/lance_namespace_urllib3_client/models/error_response.py +++ b/python/lance_namespace_urllib3_client/lance_namespace_urllib3_client/models/error_response.py @@ -28,7 +28,7 @@ class ErrorResponse(BaseModel): Common JSON error response model """ # noqa: E501 error: Optional[StrictStr] = Field(default=None, description="A brief, human-readable message about the error.") - code: Annotated[int, Field(strict=True, ge=0)] = Field(description="Lance Namespace error code identifying the error type. Error codes: 0 - Unsupported: Operation not supported by this backend 1 - NamespaceNotFound: The specified namespace does not exist 2 - NamespaceAlreadyExists: A namespace with this name already exists 3 - NamespaceNotEmpty: Namespace contains tables or child namespaces 4 - TableNotFound: The specified table does not exist 5 - TableAlreadyExists: A table with this name already exists 6 - TableIndexNotFound: The specified table index does not exist 7 - TableIndexAlreadyExists: A table index with this name already exists 8 - TableTagNotFound: The specified table tag does not exist 9 - TableTagAlreadyExists: A table tag with this name already exists 10 - TransactionNotFound: The specified transaction does not exist 11 - TableVersionNotFound: The specified table version does not exist 12 - TableColumnNotFound: The specified table field does not exist 13 - InvalidInput: Malformed request or invalid parameters 14 - ConcurrentModification: Optimistic concurrency conflict 15 - PermissionDenied: User lacks permission for this operation 16 - Unauthenticated: Authentication credentials are missing or invalid 17 - ServiceUnavailable: Service is temporarily unavailable 18 - Internal: Unexpected server/implementation error 19 - InvalidTableState: Table is in an invalid state for the operation 20 - TableSchemaValidationError: Table schema validation failed ") + code: Annotated[int, Field(strict=True, ge=0)] = Field(description="Lance Namespace error code identifying the error type. Error codes: 0 - Unsupported: Operation not supported by this backend 1 - NamespaceNotFound: The specified namespace does not exist 2 - NamespaceAlreadyExists: A namespace with this name already exists 3 - NamespaceNotEmpty: Namespace contains tables or child namespaces 4 - TableNotFound: The specified table does not exist 5 - TableAlreadyExists: A table with this name already exists 6 - TableIndexNotFound: The specified table index does not exist 7 - TableIndexAlreadyExists: A table index with this name already exists 8 - TableTagNotFound: The specified table tag does not exist 9 - TableTagAlreadyExists: A table tag with this name already exists 10 - TransactionNotFound: The specified transaction does not exist 11 - TableVersionNotFound: The specified table version does not exist 12 - TableColumnNotFound: The specified table field does not exist 13 - InvalidInput: Malformed request or invalid parameters 14 - ConcurrentModification: Optimistic concurrency conflict 15 - PermissionDenied: User lacks permission for this operation 16 - Unauthenticated: Authentication credentials are missing or invalid 17 - ServiceUnavailable: Service is temporarily unavailable 18 - Internal: Unexpected server/implementation error 19 - InvalidTableState: Table is in an invalid state for the operation 20 - TableSchemaValidationError: Table schema validation failed 21 - Throttling: Request rate limit exceeded 22 - TableBranchNotFound: The specified table branch does not exist 23 - TableBranchAlreadyExists: A table branch with this name already exists ") detail: Optional[StrictStr] = Field(default=None, description="An optional human-readable explanation of the error. This can be used to record additional information such as stack trace. ") instance: Optional[StrictStr] = Field(default=None, description="A string that identifies the specific occurrence of the error. This can be a URI, a request or response ID, or anything that the implementation can recognize to trace specific occurrence of the error. ") __properties: ClassVar[List[str]] = ["error", "code", "detail", "instance"] diff --git a/rust/lance-namespace-reqwest-client/docs/ErrorResponse.md b/rust/lance-namespace-reqwest-client/docs/ErrorResponse.md index 83f27427f..7938b5711 100644 --- a/rust/lance-namespace-reqwest-client/docs/ErrorResponse.md +++ b/rust/lance-namespace-reqwest-client/docs/ErrorResponse.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **error** | Option<**String**> | A brief, human-readable message about the error. | [optional] -**code** | **i32** | Lance Namespace error code identifying the error type. Error codes: 0 - Unsupported: Operation not supported by this backend 1 - NamespaceNotFound: The specified namespace does not exist 2 - NamespaceAlreadyExists: A namespace with this name already exists 3 - NamespaceNotEmpty: Namespace contains tables or child namespaces 4 - TableNotFound: The specified table does not exist 5 - TableAlreadyExists: A table with this name already exists 6 - TableIndexNotFound: The specified table index does not exist 7 - TableIndexAlreadyExists: A table index with this name already exists 8 - TableTagNotFound: The specified table tag does not exist 9 - TableTagAlreadyExists: A table tag with this name already exists 10 - TransactionNotFound: The specified transaction does not exist 11 - TableVersionNotFound: The specified table version does not exist 12 - TableColumnNotFound: The specified table field does not exist 13 - InvalidInput: Malformed request or invalid parameters 14 - ConcurrentModification: Optimistic concurrency conflict 15 - PermissionDenied: User lacks permission for this operation 16 - Unauthenticated: Authentication credentials are missing or invalid 17 - ServiceUnavailable: Service is temporarily unavailable 18 - Internal: Unexpected server/implementation error 19 - InvalidTableState: Table is in an invalid state for the operation 20 - TableSchemaValidationError: Table schema validation failed | +**code** | **i32** | Lance Namespace error code identifying the error type. Error codes: 0 - Unsupported: Operation not supported by this backend 1 - NamespaceNotFound: The specified namespace does not exist 2 - NamespaceAlreadyExists: A namespace with this name already exists 3 - NamespaceNotEmpty: Namespace contains tables or child namespaces 4 - TableNotFound: The specified table does not exist 5 - TableAlreadyExists: A table with this name already exists 6 - TableIndexNotFound: The specified table index does not exist 7 - TableIndexAlreadyExists: A table index with this name already exists 8 - TableTagNotFound: The specified table tag does not exist 9 - TableTagAlreadyExists: A table tag with this name already exists 10 - TransactionNotFound: The specified transaction does not exist 11 - TableVersionNotFound: The specified table version does not exist 12 - TableColumnNotFound: The specified table field does not exist 13 - InvalidInput: Malformed request or invalid parameters 14 - ConcurrentModification: Optimistic concurrency conflict 15 - PermissionDenied: User lacks permission for this operation 16 - Unauthenticated: Authentication credentials are missing or invalid 17 - ServiceUnavailable: Service is temporarily unavailable 18 - Internal: Unexpected server/implementation error 19 - InvalidTableState: Table is in an invalid state for the operation 20 - TableSchemaValidationError: Table schema validation failed 21 - Throttling: Request rate limit exceeded 22 - TableBranchNotFound: The specified table branch does not exist 23 - TableBranchAlreadyExists: A table branch with this name already exists | **detail** | Option<**String**> | An optional human-readable explanation of the error. This can be used to record additional information such as stack trace. | [optional] **instance** | Option<**String**> | A string that identifies the specific occurrence of the error. This can be a URI, a request or response ID, or anything that the implementation can recognize to trace specific occurrence of the error. | [optional] diff --git a/rust/lance-namespace-reqwest-client/src/models/error_response.rs b/rust/lance-namespace-reqwest-client/src/models/error_response.rs index 72161cb6b..c2a7eb71f 100644 --- a/rust/lance-namespace-reqwest-client/src/models/error_response.rs +++ b/rust/lance-namespace-reqwest-client/src/models/error_response.rs @@ -17,7 +17,7 @@ pub struct ErrorResponse { /// A brief, human-readable message about the error. #[serde(rename = "error", skip_serializing_if = "Option::is_none")] pub error: Option, - /// Lance Namespace error code identifying the error type. Error codes: 0 - Unsupported: Operation not supported by this backend 1 - NamespaceNotFound: The specified namespace does not exist 2 - NamespaceAlreadyExists: A namespace with this name already exists 3 - NamespaceNotEmpty: Namespace contains tables or child namespaces 4 - TableNotFound: The specified table does not exist 5 - TableAlreadyExists: A table with this name already exists 6 - TableIndexNotFound: The specified table index does not exist 7 - TableIndexAlreadyExists: A table index with this name already exists 8 - TableTagNotFound: The specified table tag does not exist 9 - TableTagAlreadyExists: A table tag with this name already exists 10 - TransactionNotFound: The specified transaction does not exist 11 - TableVersionNotFound: The specified table version does not exist 12 - TableColumnNotFound: The specified table field does not exist 13 - InvalidInput: Malformed request or invalid parameters 14 - ConcurrentModification: Optimistic concurrency conflict 15 - PermissionDenied: User lacks permission for this operation 16 - Unauthenticated: Authentication credentials are missing or invalid 17 - ServiceUnavailable: Service is temporarily unavailable 18 - Internal: Unexpected server/implementation error 19 - InvalidTableState: Table is in an invalid state for the operation 20 - TableSchemaValidationError: Table schema validation failed + /// Lance Namespace error code identifying the error type. Error codes: 0 - Unsupported: Operation not supported by this backend 1 - NamespaceNotFound: The specified namespace does not exist 2 - NamespaceAlreadyExists: A namespace with this name already exists 3 - NamespaceNotEmpty: Namespace contains tables or child namespaces 4 - TableNotFound: The specified table does not exist 5 - TableAlreadyExists: A table with this name already exists 6 - TableIndexNotFound: The specified table index does not exist 7 - TableIndexAlreadyExists: A table index with this name already exists 8 - TableTagNotFound: The specified table tag does not exist 9 - TableTagAlreadyExists: A table tag with this name already exists 10 - TransactionNotFound: The specified transaction does not exist 11 - TableVersionNotFound: The specified table version does not exist 12 - TableColumnNotFound: The specified table field does not exist 13 - InvalidInput: Malformed request or invalid parameters 14 - ConcurrentModification: Optimistic concurrency conflict 15 - PermissionDenied: User lacks permission for this operation 16 - Unauthenticated: Authentication credentials are missing or invalid 17 - ServiceUnavailable: Service is temporarily unavailable 18 - Internal: Unexpected server/implementation error 19 - InvalidTableState: Table is in an invalid state for the operation 20 - TableSchemaValidationError: Table schema validation failed 21 - Throttling: Request rate limit exceeded 22 - TableBranchNotFound: The specified table branch does not exist 23 - TableBranchAlreadyExists: A table branch with this name already exists #[serde(rename = "code")] pub code: i32, /// An optional human-readable explanation of the error. This can be used to record additional information such as stack trace.