Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

add xspace-agent/xspace-agent/agent-voice-chat/src/server/errors.js

oversteppingeec9f9b09d6d
diff --git a/xspace-agent/xspace-agent/agent-voice-chat/src/server/errors.js b/xspace-agent/xspace-agent/agent-voice-chat/src/server/errors.js
new file mode 100644
index 000000000..bd39c8672
--- /dev/null
+++ b/xspace-agent/xspace-agent/agent-voice-chat/src/server/errors.js
@@ -0,0 +1,61 @@
+// SPDX-License-Identifier: Apache-2.0
+// Copyright 2026 nirholas (https://github.com/nirholas/xspace-agent)
+
+const ERROR_CODES = {
+ NOT_FOUND: "NOT_FOUND",
+ CONFLICT: "CONFLICT",
+ VALIDATION_ERROR: "VALIDATION_ERROR",
+ PROVIDER_ERROR: "PROVIDER_ERROR",
+ RATE_LIMITED: "RATE_LIMITED",
+ UNAUTHORIZED: "UNAUTHORIZED",
+ INTERNAL_ERROR: "INTERNAL_ERROR",
+ NOT_IMPLEMENTED: "NOT_IMPLEMENTED",
+}
+
+class AppError extends Error {
+ constructor(code, message, httpStatus = 500) {
+ super(message)
+ this.name = "AppError"
+ this.code = code
+ this.httpStatus = httpStatus
+ }
+}
+
+class NotFoundError extends AppError {
+ constructor(message = "Not found") {
+ super(ERROR_CODES.NOT_FOUND, message, 404)
+ this.name = "NotFoundError"
+ }
+}
+
+class ConflictError extends AppError {
+ constructor(message = "Conflict") {
+ super(ERROR_CODES.CONFLICT, message, 409)
+ this.name = "ConflictError"
+ }
+}
+
+class ValidationError extends AppError {
+ constructor(message = "Validation error") {
+ super(ERROR_CODES.VALIDATION_ERROR, message, 400)
+ this.name = "ValidationError"
+ }
+}
+
+class ProviderError extends AppError {
+ constructor(message = "Provider error") {
+ super(ERROR_CODES.PROVIDER_ERROR, message, 502)
+ this.name = "ProviderError"
+ }
+}
+
+class ForbiddenError extends AppError {
+ constructor(message = "Forbidden") {
+ super("FORBIDDEN", message, 403)
+ this.name = "ForbiddenError"
+ }
+}
+
+module.exports = { ERROR_CODES, AppError, NotFoundError, ConflictError, ValidationError, ProviderError, ForbiddenError }
+
+