WeaviateEx.Error exception (WeaviateEx v0.7.4)

View Source

Error struct for WeaviateEx operations.

Summary

Functions

Create a backup already exists error.

Create a backup failed error.

Create a backup not found error.

Create a backup timeout error.

Create a cluster not ready error.

Create error from GRPC.RPCError struct.

Create error from gRPC status code.

Create error from HTTP status code

Checks if a gRPC status code is retryable.

Create an invalid backup backend error.

Create an invalid permission error.

Create a node not found error.

Create a permission denied error.

Create an RBAC-specific error with category metadata.

Create a replication failed error.

Create a replication timeout error.

Create a restore failed error.

Create a role not found error.

Create a shard not found error.

Create a user not found error.

Create a vector indexing timeout error.

Types

t()

@type t() :: %WeaviateEx.Error{
  __exception__: true,
  details: map(),
  message: String.t(),
  status_code: integer() | nil,
  type: atom()
}

Functions

backup_already_exists(backup_id, backend)

@spec backup_already_exists(String.t(), atom()) :: t()

Create a backup already exists error.

Examples

error = Error.backup_already_exists("backup-123", :s3)

backup_failed(backup_id, reason)

@spec backup_failed(String.t(), String.t()) :: t()

Create a backup failed error.

Examples

error = Error.backup_failed("backup-123", "disk full")

backup_not_found(backup_id, backend)

@spec backup_not_found(String.t(), atom()) :: t()

Create a backup not found error.

Examples

error = Error.backup_not_found("backup-123", :filesystem)

backup_timeout(backup_id, operation)

@spec backup_timeout(String.t(), atom()) :: t()

Create a backup timeout error.

Examples

error = Error.backup_timeout("backup-123", :create)

cluster_not_ready()

@spec cluster_not_ready() :: t()

Create a cluster not ready error.

Examples

error = Error.cluster_not_ready()

from_grpc_error(rpc_error)

@spec from_grpc_error(GRPC.RPCError.t()) :: t()

Create error from GRPC.RPCError struct.

Examples

error = Error.from_grpc_error(%GRPC.RPCError{status: 5, message: "Not found"})
error.type #=> :not_found

from_grpc_status(status_code, message, details \\ %{})

@spec from_grpc_status(atom(), String.t(), map()) :: t()

Create error from gRPC status code.

Maps gRPC status codes to WeaviateEx error types.

Examples

error = Error.from_grpc_status(:not_found, "Object not found")
error.type #=> :not_found

error = Error.from_grpc_status(:unavailable, "Service unavailable")
error.type #=> :service_unavailable

from_status_code(code, body)

Create error from HTTP status code

grpc_retryable?(arg1)

@spec grpc_retryable?(atom()) :: boolean()

Checks if a gRPC status code is retryable.

Examples

true = Error.grpc_retryable?(:unavailable)
true = Error.grpc_retryable?(:resource_exhausted)
false = Error.grpc_retryable?(:invalid_argument)

invalid_backend(backend)

@spec invalid_backend(atom()) :: t()

Create an invalid backup backend error.

Examples

error = Error.invalid_backend(:invalid)

invalid_permission(reason)

@spec invalid_permission(String.t()) :: t()

Create an invalid permission error.

Examples

error = Error.invalid_permission("Invalid action for collection type")

node_not_found(node_name)

@spec node_not_found(String.t()) :: t()

Create a node not found error.

Examples

error = Error.node_not_found("node-1")

permission_denied(action, resource)

@spec permission_denied(atom(), String.t()) :: t()

Create a permission denied error.

Examples

error = Error.permission_denied(:delete, "Article")

rbac_error(type, message, details \\ %{})

@spec rbac_error(atom(), String.t(), map()) :: t()

Create an RBAC-specific error with category metadata.

Examples

error = Error.rbac_error(:not_found, "Role not found", %{role: "admin"})

replication_failed(operation_id, reason)

@spec replication_failed(String.t(), String.t()) :: t()

Create a replication failed error.

Examples

error = Error.replication_failed("op-123", "target node unavailable")

replication_timeout(operation_id)

@spec replication_timeout(String.t()) :: t()

Create a replication timeout error.

Examples

error = Error.replication_timeout("op-123")

restore_failed(backup_id, reason)

@spec restore_failed(String.t(), String.t()) :: t()

Create a restore failed error.

Examples

error = Error.restore_failed("backup-123", "collection already exists")

role_not_found(role_name)

@spec role_not_found(String.t()) :: t()

Create a role not found error.

Examples

error = Error.role_not_found("admin")

shard_not_found(collection, shard_name)

@spec shard_not_found(String.t(), String.t()) :: t()

Create a shard not found error.

Examples

error = Error.shard_not_found("Article", "shard-1")

user_not_found(user_id)

@spec user_not_found(String.t()) :: t()

Create a user not found error.

Examples

error = Error.user_not_found("john.doe")

vector_indexing_timeout(collection)

@spec vector_indexing_timeout(String.t()) :: t()

Create a vector indexing timeout error.

Examples

error = Error.vector_indexing_timeout("Article")