@zudojs/errors 0.1.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +29 -8
- package/dist/base/core/baseError.core.d.ts +25 -2
- package/dist/base/core/baseError.core.js +95 -23
- package/dist/base/core/errorMetadata.core.d.ts +62 -5
- package/dist/base/core/errorMetadata.core.js +280 -23
- package/dist/base/types/errorCategory.helpers.js +3 -2
- package/dist/base/types/errorCode.type.d.ts +70 -1
- package/dist/base/types/errorCode.type.js +78 -2
- package/dist/base/types/errorSeverity.type.js +3 -2
- package/dist/base/utils/baseError.utils.d.ts +18 -2
- package/dist/base/utils/baseError.utils.js +68 -17
- package/dist/domain/access/rateLimit.error.d.ts +6 -1
- package/dist/domain/access/rateLimit.error.js +7 -9
- package/dist/domain/api/apiError.base.d.ts +3 -0
- package/dist/domain/api/apiError.base.js +5 -2
- package/dist/domain/api/apiError.lifecycle.d.ts +15 -1
- package/dist/domain/api/apiError.lifecycle.js +27 -7
- package/dist/domain/api/apiError.routing.d.ts +11 -3
- package/dist/domain/api/apiError.routing.js +12 -7
- package/dist/domain/app/domain.error.d.ts +2 -0
- package/dist/domain/app/domain.error.js +3 -1
- package/dist/domain/app/lifecycleError.types.js +2 -8
- package/dist/domain/app/moduleError.types.d.ts +3 -0
- package/dist/domain/app/moduleError.types.js +6 -2
- package/dist/domain/body/bodyParser.error.d.ts +9 -2
- package/dist/domain/body/bodyParser.error.js +20 -12
- package/dist/domain/body/httpBodyError.base.js +1 -2
- package/dist/domain/body/httpBodyError.types.js +1 -3
- package/dist/domain/body/httpFormData.error.js +2 -4
- package/dist/domain/body/multipart.error.js +2 -4
- package/dist/domain/documentation/documentationError.base.js +4 -2
- package/dist/domain/documentation/documentationError.types.js +1 -11
- package/dist/domain/documentation/index.d.ts +1 -1
- package/dist/domain/documentation/index.js +1 -1
- package/dist/domain/event/event.error.d.ts +1 -1
- package/dist/domain/event/event.error.js +1 -1
- package/dist/domain/event/eventError.base.d.ts +4 -1
- package/dist/domain/event/eventError.base.js +7 -9
- package/dist/domain/event/eventError.handler.d.ts +12 -3
- package/dist/domain/event/eventError.handler.js +21 -11
- package/dist/domain/event/eventError.lifecycle.d.ts +20 -3
- package/dist/domain/event/eventError.lifecycle.js +48 -18
- package/dist/domain/event/eventError.serialization.d.ts +10 -2
- package/dist/domain/event/eventError.serialization.js +16 -4
- package/dist/domain/message/message.error.d.ts +1 -0
- package/dist/domain/message/message.error.js +1 -0
- package/dist/domain/message/messageError.base.d.ts +4 -1
- package/dist/domain/message/messageError.base.js +7 -9
- package/dist/domain/message/messageError.handler.d.ts +12 -3
- package/dist/domain/message/messageError.handler.js +22 -12
- package/dist/domain/message/messageError.lifecycle.d.ts +5 -1
- package/dist/domain/message/messageError.lifecycle.js +15 -8
- package/dist/domain/message/messageError.serialization.d.ts +26 -0
- package/dist/domain/message/messageError.serialization.js +35 -0
- package/dist/domain/plugin/pluginError.lifecycle.js +23 -21
- package/dist/domain/plugin/pluginError.runtime.d.ts +5 -1
- package/dist/domain/plugin/pluginError.runtime.js +12 -7
- package/dist/domain/queue/queueError.base.d.ts +19 -0
- package/dist/domain/queue/queueError.base.js +24 -4
- package/dist/domain/queue/queueError.job.js +2 -0
- package/dist/domain/queue/queueError.worker.d.ts +9 -3
- package/dist/domain/queue/queueError.worker.js +14 -6
- package/dist/domain/rpc/rpcError.base.js +0 -2
- package/dist/domain/rpc/rpcError.protocol.js +0 -7
- package/dist/domain/rpc/rpcError.transport.d.ts +10 -1
- package/dist/domain/rpc/rpcError.transport.js +19 -9
- package/dist/domain/scheduler/schedulerError.base.d.ts +17 -3
- package/dist/domain/scheduler/schedulerError.base.js +26 -15
- package/dist/domain/scheduler/schedulerError.execution.d.ts +7 -6
- package/dist/domain/scheduler/schedulerError.execution.js +22 -18
- package/dist/domain/scheduler/schedulerError.schedule.d.ts +15 -5
- package/dist/domain/scheduler/schedulerError.schedule.js +32 -14
- package/dist/domain/schema/index.d.ts +2 -1
- package/dist/domain/schema/index.js +1 -1
- package/dist/domain/schema/schemaError.base.d.ts +31 -5
- package/dist/domain/schema/schemaError.base.js +34 -6
- package/dist/domain/schema/schemaError.types.js +12 -5
- package/dist/domain/serialization/serializationError.base.d.ts +8 -2
- package/dist/domain/serialization/serializationError.base.js +38 -8
- package/dist/domain/serialization/serializationError.types.d.ts +22 -3
- package/dist/domain/serialization/serializationError.types.js +30 -5
- package/dist/domain/shared/domainError.helpers.d.ts +60 -0
- package/dist/domain/shared/domainError.helpers.js +191 -0
- package/dist/domain/state/conflict.error.d.ts +1 -1
- package/dist/domain/state/conflict.error.js +2 -2
- package/dist/domain/state/validationError.base.d.ts +8 -1
- package/dist/domain/state/validationError.base.js +11 -2
- package/dist/infrastructure/adapter/adapterError.base.js +6 -6
- package/dist/infrastructure/adapter/adapterError.lifecycle.js +0 -3
- package/dist/infrastructure/adapter/adapterError.operation.js +0 -5
- package/dist/infrastructure/cache/cacheError.base.js +1 -1
- package/dist/infrastructure/container/containerError.registration.js +6 -4
- package/dist/infrastructure/network/httpAdapter.error.js +4 -2
- package/dist/infrastructure/network/httpClientError.advanced.js +10 -18
- package/dist/infrastructure/network/httpClientError.base.d.ts +11 -0
- package/dist/infrastructure/network/httpClientError.base.js +47 -7
- package/dist/infrastructure/network/httpClientError.common.d.ts +14 -0
- package/dist/infrastructure/network/httpClientError.common.js +21 -31
- package/dist/infrastructure/network/httpClientError.specialized.js +5 -8
- package/dist/infrastructure/network/httpClientError.types.d.ts +23 -2
- package/dist/infrastructure/network/httpClientError.types.js +55 -42
- package/dist/infrastructure/network/httpResponse.error.js +0 -3
- package/dist/infrastructure/network/httpRouterError.base.js +0 -1
- package/dist/infrastructure/network/httpRouterError.types.d.ts +5 -3
- package/dist/infrastructure/network/httpRouterError.types.js +6 -7
- package/dist/infrastructure/network/httpServerError.error.js +6 -10
- package/dist/infrastructure/network/httpServerLifecycleError.base.js +0 -1
- package/dist/infrastructure/network/httpServerLifecycleError.types.js +0 -3
- package/dist/infrastructure/network/httpStream.error.js +0 -1
- package/dist/infrastructure/network/network.error.d.ts +1 -1
- package/dist/infrastructure/network/network.error.js +1 -1
- package/dist/infrastructure/network/networkError.factory.d.ts +9 -2
- package/dist/infrastructure/network/networkError.factory.js +9 -2
- package/dist/infrastructure/network/routePattern.error.d.ts +7 -6
- package/dist/infrastructure/network/routePattern.error.js +16 -8
- package/dist/infrastructure/network/timeoutError.base.d.ts +7 -0
- package/dist/infrastructure/network/timeoutError.base.js +12 -1
- package/dist/infrastructure/network/timeoutError.factory.d.ts +14 -0
- package/dist/infrastructure/network/timeoutError.factory.js +25 -17
- package/dist/infrastructure/service/externalService.error.d.ts +1 -1
- package/dist/infrastructure/service/externalService.error.js +1 -1
- package/dist/infrastructure/service/externalServiceError.base.d.ts +8 -0
- package/dist/infrastructure/service/externalServiceError.base.js +8 -11
- package/dist/infrastructure/service/externalServiceError.factory.d.ts +3 -1
- package/dist/infrastructure/service/externalServiceError.factory.js +3 -1
- package/dist/infrastructure/storage/databaseError.factory.js +1 -1
- package/dist/infrastructure/storage/storageError.factory.js +2 -2
- package/dist/system/cryptoError.factory.js +5 -2
- package/dist/system/runtimeError.base.js +1 -1
- package/dist/utils/errorHandler.core.d.ts +42 -8
- package/dist/utils/errorHandler.core.js +116 -63
- package/dist/utils/errorHandler.factory.d.ts +1 -1
- package/dist/utils/errorHandler.factory.js +2 -2
- package/dist/utils/errorHandler.types.d.ts +37 -1
- package/dist/utils/errorMapper.core.d.ts +1 -1
- package/dist/utils/errorMapper.core.js +1 -1
- package/dist/utils/errorMapper.mappers.d.ts +27 -6
- package/dist/utils/errorMapper.mappers.js +57 -49
- package/dist/utils/errorSerializer.core.d.ts +22 -3
- package/dist/utils/errorSerializer.core.js +88 -40
- package/dist/utils/errorSerializer.factory.d.ts +1 -1
- package/dist/utils/errorSerializer.factory.js +2 -26
- package/dist/utils/errorSerializer.types.d.ts +14 -4
- package/dist/utils/errorUtils.extraction.js +3 -2
- package/dist/utils/errorUtils.transform.d.ts +1 -1
- package/dist/utils/errorUtils.transform.js +2 -26
- package/dist/utils/errorUtils.typeCheck.js +7 -7
- package/package.json +21 -10
- package/dist/.tsbuildinfo +0 -1
- package/dist/base/core/baseError.core.d.ts.map +0 -1
- package/dist/base/core/baseError.core.js.map +0 -1
- package/dist/base/core/errorMetadata.core.d.ts.map +0 -1
- package/dist/base/core/errorMetadata.core.js.map +0 -1
- package/dist/base/core/errorMetadata.type.d.ts.map +0 -1
- package/dist/base/core/errorMetadata.type.js.map +0 -1
- package/dist/base/core/index.d.ts.map +0 -1
- package/dist/base/core/index.js.map +0 -1
- package/dist/base/index.d.ts.map +0 -1
- package/dist/base/index.js.map +0 -1
- package/dist/base/types/baseError.type.d.ts.map +0 -1
- package/dist/base/types/baseError.type.js.map +0 -1
- package/dist/base/types/errorCategory.enum.d.ts.map +0 -1
- package/dist/base/types/errorCategory.enum.js.map +0 -1
- package/dist/base/types/errorCategory.helpers.d.ts.map +0 -1
- package/dist/base/types/errorCategory.helpers.js.map +0 -1
- package/dist/base/types/errorCategory.type.d.ts.map +0 -1
- package/dist/base/types/errorCategory.type.js.map +0 -1
- package/dist/base/types/errorCode.type.d.ts.map +0 -1
- package/dist/base/types/errorCode.type.js.map +0 -1
- package/dist/base/types/errorSeverity.type.d.ts.map +0 -1
- package/dist/base/types/errorSeverity.type.js.map +0 -1
- package/dist/base/types/index.d.ts.map +0 -1
- package/dist/base/types/index.js.map +0 -1
- package/dist/base/utils/baseError.utils.d.ts.map +0 -1
- package/dist/base/utils/baseError.utils.js.map +0 -1
- package/dist/base/utils/index.d.ts.map +0 -1
- package/dist/base/utils/index.js.map +0 -1
- package/dist/domain/access/authentication.error.d.ts.map +0 -1
- package/dist/domain/access/authentication.error.js.map +0 -1
- package/dist/domain/access/authorization.error.d.ts.map +0 -1
- package/dist/domain/access/authorization.error.js.map +0 -1
- package/dist/domain/access/index.d.ts.map +0 -1
- package/dist/domain/access/index.js.map +0 -1
- package/dist/domain/access/rateLimit.error.d.ts.map +0 -1
- package/dist/domain/access/rateLimit.error.js.map +0 -1
- package/dist/domain/api/api.error.d.ts.map +0 -1
- package/dist/domain/api/api.error.js.map +0 -1
- package/dist/domain/api/apiError.base.d.ts.map +0 -1
- package/dist/domain/api/apiError.base.js.map +0 -1
- package/dist/domain/api/apiError.lifecycle.d.ts.map +0 -1
- package/dist/domain/api/apiError.lifecycle.js.map +0 -1
- package/dist/domain/api/apiError.routing.d.ts.map +0 -1
- package/dist/domain/api/apiError.routing.js.map +0 -1
- package/dist/domain/api/index.d.ts.map +0 -1
- package/dist/domain/api/index.js.map +0 -1
- package/dist/domain/app/application.error.d.ts.map +0 -1
- package/dist/domain/app/application.error.js.map +0 -1
- package/dist/domain/app/configuration.error.d.ts.map +0 -1
- package/dist/domain/app/configuration.error.js.map +0 -1
- package/dist/domain/app/domain.error.d.ts.map +0 -1
- package/dist/domain/app/domain.error.js.map +0 -1
- package/dist/domain/app/index.d.ts.map +0 -1
- package/dist/domain/app/index.js.map +0 -1
- package/dist/domain/app/lifecycle.error.d.ts.map +0 -1
- package/dist/domain/app/lifecycle.error.js.map +0 -1
- package/dist/domain/app/lifecycleError.base.d.ts.map +0 -1
- package/dist/domain/app/lifecycleError.base.js.map +0 -1
- package/dist/domain/app/lifecycleError.types.d.ts.map +0 -1
- package/dist/domain/app/lifecycleError.types.js.map +0 -1
- package/dist/domain/app/module.error.d.ts.map +0 -1
- package/dist/domain/app/module.error.js.map +0 -1
- package/dist/domain/app/moduleError.base.d.ts.map +0 -1
- package/dist/domain/app/moduleError.base.js.map +0 -1
- package/dist/domain/app/moduleError.types.d.ts.map +0 -1
- package/dist/domain/app/moduleError.types.js.map +0 -1
- package/dist/domain/body/bodyParser.error.d.ts.map +0 -1
- package/dist/domain/body/bodyParser.error.js.map +0 -1
- package/dist/domain/body/httpBody.error.d.ts.map +0 -1
- package/dist/domain/body/httpBody.error.js.map +0 -1
- package/dist/domain/body/httpBodyError.base.d.ts.map +0 -1
- package/dist/domain/body/httpBodyError.base.js.map +0 -1
- package/dist/domain/body/httpBodyError.types.d.ts.map +0 -1
- package/dist/domain/body/httpBodyError.types.js.map +0 -1
- package/dist/domain/body/httpFormData.error.d.ts.map +0 -1
- package/dist/domain/body/httpFormData.error.js.map +0 -1
- package/dist/domain/body/index.d.ts.map +0 -1
- package/dist/domain/body/index.js.map +0 -1
- package/dist/domain/body/multipart.error.d.ts.map +0 -1
- package/dist/domain/body/multipart.error.js.map +0 -1
- package/dist/domain/documentation/documentation.error.d.ts.map +0 -1
- package/dist/domain/documentation/documentation.error.js.map +0 -1
- package/dist/domain/documentation/documentationError.base.d.ts.map +0 -1
- package/dist/domain/documentation/documentationError.base.js.map +0 -1
- package/dist/domain/documentation/documentationError.types.d.ts.map +0 -1
- package/dist/domain/documentation/documentationError.types.js.map +0 -1
- package/dist/domain/documentation/index.d.ts.map +0 -1
- package/dist/domain/documentation/index.js.map +0 -1
- package/dist/domain/event/event.error.d.ts.map +0 -1
- package/dist/domain/event/event.error.js.map +0 -1
- package/dist/domain/event/eventError.base.d.ts.map +0 -1
- package/dist/domain/event/eventError.base.js.map +0 -1
- package/dist/domain/event/eventError.handler.d.ts.map +0 -1
- package/dist/domain/event/eventError.handler.js.map +0 -1
- package/dist/domain/event/eventError.lifecycle.d.ts.map +0 -1
- package/dist/domain/event/eventError.lifecycle.js.map +0 -1
- package/dist/domain/event/eventError.serialization.d.ts.map +0 -1
- package/dist/domain/event/eventError.serialization.js.map +0 -1
- package/dist/domain/event/index.d.ts.map +0 -1
- package/dist/domain/event/index.js.map +0 -1
- package/dist/domain/index.d.ts.map +0 -1
- package/dist/domain/index.js.map +0 -1
- package/dist/domain/message/index.d.ts.map +0 -1
- package/dist/domain/message/index.js.map +0 -1
- package/dist/domain/message/message.error.d.ts.map +0 -1
- package/dist/domain/message/message.error.js.map +0 -1
- package/dist/domain/message/messageError.base.d.ts.map +0 -1
- package/dist/domain/message/messageError.base.js.map +0 -1
- package/dist/domain/message/messageError.handler.d.ts.map +0 -1
- package/dist/domain/message/messageError.handler.js.map +0 -1
- package/dist/domain/message/messageError.lifecycle.d.ts.map +0 -1
- package/dist/domain/message/messageError.lifecycle.js.map +0 -1
- package/dist/domain/message/messageError.validation.d.ts.map +0 -1
- package/dist/domain/message/messageError.validation.js.map +0 -1
- package/dist/domain/plugin/index.d.ts.map +0 -1
- package/dist/domain/plugin/index.js.map +0 -1
- package/dist/domain/plugin/plugin.error.d.ts.map +0 -1
- package/dist/domain/plugin/plugin.error.js.map +0 -1
- package/dist/domain/plugin/pluginError.base.d.ts.map +0 -1
- package/dist/domain/plugin/pluginError.base.js.map +0 -1
- package/dist/domain/plugin/pluginError.lifecycle.d.ts.map +0 -1
- package/dist/domain/plugin/pluginError.lifecycle.js.map +0 -1
- package/dist/domain/plugin/pluginError.runtime.d.ts.map +0 -1
- package/dist/domain/plugin/pluginError.runtime.js.map +0 -1
- package/dist/domain/queue/index.d.ts.map +0 -1
- package/dist/domain/queue/index.js.map +0 -1
- package/dist/domain/queue/queue.error.d.ts.map +0 -1
- package/dist/domain/queue/queue.error.js.map +0 -1
- package/dist/domain/queue/queueError.base.d.ts.map +0 -1
- package/dist/domain/queue/queueError.base.js.map +0 -1
- package/dist/domain/queue/queueError.job.d.ts.map +0 -1
- package/dist/domain/queue/queueError.job.js.map +0 -1
- package/dist/domain/queue/queueError.queue.d.ts.map +0 -1
- package/dist/domain/queue/queueError.queue.js.map +0 -1
- package/dist/domain/queue/queueError.worker.d.ts.map +0 -1
- package/dist/domain/queue/queueError.worker.js.map +0 -1
- package/dist/domain/rpc/index.d.ts.map +0 -1
- package/dist/domain/rpc/index.js.map +0 -1
- package/dist/domain/rpc/rpc.error.d.ts.map +0 -1
- package/dist/domain/rpc/rpc.error.js.map +0 -1
- package/dist/domain/rpc/rpcError.base.d.ts.map +0 -1
- package/dist/domain/rpc/rpcError.base.js.map +0 -1
- package/dist/domain/rpc/rpcError.protocol.d.ts.map +0 -1
- package/dist/domain/rpc/rpcError.protocol.js.map +0 -1
- package/dist/domain/rpc/rpcError.transport.d.ts.map +0 -1
- package/dist/domain/rpc/rpcError.transport.js.map +0 -1
- package/dist/domain/scheduler/index.d.ts.map +0 -1
- package/dist/domain/scheduler/index.js.map +0 -1
- package/dist/domain/scheduler/scheduler.error.d.ts.map +0 -1
- package/dist/domain/scheduler/scheduler.error.js.map +0 -1
- package/dist/domain/scheduler/schedulerError.base.d.ts.map +0 -1
- package/dist/domain/scheduler/schedulerError.base.js.map +0 -1
- package/dist/domain/scheduler/schedulerError.execution.d.ts.map +0 -1
- package/dist/domain/scheduler/schedulerError.execution.js.map +0 -1
- package/dist/domain/scheduler/schedulerError.schedule.d.ts.map +0 -1
- package/dist/domain/scheduler/schedulerError.schedule.js.map +0 -1
- package/dist/domain/schema/index.d.ts.map +0 -1
- package/dist/domain/schema/index.js.map +0 -1
- package/dist/domain/schema/schema.error.d.ts.map +0 -1
- package/dist/domain/schema/schema.error.js.map +0 -1
- package/dist/domain/schema/schemaError.base.d.ts.map +0 -1
- package/dist/domain/schema/schemaError.base.js.map +0 -1
- package/dist/domain/schema/schemaError.types.d.ts.map +0 -1
- package/dist/domain/schema/schemaError.types.js.map +0 -1
- package/dist/domain/serialization/index.d.ts.map +0 -1
- package/dist/domain/serialization/index.js.map +0 -1
- package/dist/domain/serialization/serialization.error.d.ts.map +0 -1
- package/dist/domain/serialization/serialization.error.js.map +0 -1
- package/dist/domain/serialization/serializationError.base.d.ts.map +0 -1
- package/dist/domain/serialization/serializationError.base.js.map +0 -1
- package/dist/domain/serialization/serializationError.types.d.ts.map +0 -1
- package/dist/domain/serialization/serializationError.types.js.map +0 -1
- package/dist/domain/state/conflict.error.d.ts.map +0 -1
- package/dist/domain/state/conflict.error.js.map +0 -1
- package/dist/domain/state/index.d.ts.map +0 -1
- package/dist/domain/state/index.js.map +0 -1
- package/dist/domain/state/notFound.error.d.ts.map +0 -1
- package/dist/domain/state/notFound.error.js.map +0 -1
- package/dist/domain/state/validation.error.d.ts.map +0 -1
- package/dist/domain/state/validation.error.js.map +0 -1
- package/dist/domain/state/validationError.base.d.ts.map +0 -1
- package/dist/domain/state/validationError.base.js.map +0 -1
- package/dist/domain/state/validationError.helpers.d.ts.map +0 -1
- package/dist/domain/state/validationError.helpers.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/infrastructure/adapter/adapter.error.d.ts.map +0 -1
- package/dist/infrastructure/adapter/adapter.error.js.map +0 -1
- package/dist/infrastructure/adapter/adapterError.base.d.ts.map +0 -1
- package/dist/infrastructure/adapter/adapterError.base.js.map +0 -1
- package/dist/infrastructure/adapter/adapterError.lifecycle.d.ts.map +0 -1
- package/dist/infrastructure/adapter/adapterError.lifecycle.js.map +0 -1
- package/dist/infrastructure/adapter/adapterError.operation.d.ts.map +0 -1
- package/dist/infrastructure/adapter/adapterError.operation.js.map +0 -1
- package/dist/infrastructure/adapter/index.d.ts.map +0 -1
- package/dist/infrastructure/adapter/index.js.map +0 -1
- package/dist/infrastructure/cache/cache.error.d.ts.map +0 -1
- package/dist/infrastructure/cache/cache.error.js.map +0 -1
- package/dist/infrastructure/cache/cacheError.base.d.ts.map +0 -1
- package/dist/infrastructure/cache/cacheError.base.js.map +0 -1
- package/dist/infrastructure/cache/cacheError.factory.d.ts.map +0 -1
- package/dist/infrastructure/cache/cacheError.factory.js.map +0 -1
- package/dist/infrastructure/cache/index.d.ts.map +0 -1
- package/dist/infrastructure/cache/index.js.map +0 -1
- package/dist/infrastructure/container/container.error.d.ts.map +0 -1
- package/dist/infrastructure/container/container.error.js.map +0 -1
- package/dist/infrastructure/container/containerError.base.d.ts.map +0 -1
- package/dist/infrastructure/container/containerError.base.js.map +0 -1
- package/dist/infrastructure/container/containerError.registration.d.ts.map +0 -1
- package/dist/infrastructure/container/containerError.registration.js.map +0 -1
- package/dist/infrastructure/container/index.d.ts.map +0 -1
- package/dist/infrastructure/container/index.js.map +0 -1
- package/dist/infrastructure/index.d.ts.map +0 -1
- package/dist/infrastructure/index.js.map +0 -1
- package/dist/infrastructure/middleware/index.d.ts.map +0 -1
- package/dist/infrastructure/middleware/index.js.map +0 -1
- package/dist/infrastructure/middleware/middleware.error.d.ts.map +0 -1
- package/dist/infrastructure/middleware/middleware.error.js.map +0 -1
- package/dist/infrastructure/network/http.error.d.ts.map +0 -1
- package/dist/infrastructure/network/http.error.js.map +0 -1
- package/dist/infrastructure/network/httpAdapter.error.d.ts.map +0 -1
- package/dist/infrastructure/network/httpAdapter.error.js.map +0 -1
- package/dist/infrastructure/network/httpClient.errors.d.ts.map +0 -1
- package/dist/infrastructure/network/httpClient.errors.js.map +0 -1
- package/dist/infrastructure/network/httpClientError.advanced.d.ts.map +0 -1
- package/dist/infrastructure/network/httpClientError.advanced.js.map +0 -1
- package/dist/infrastructure/network/httpClientError.base.d.ts.map +0 -1
- package/dist/infrastructure/network/httpClientError.base.js.map +0 -1
- package/dist/infrastructure/network/httpClientError.common.d.ts.map +0 -1
- package/dist/infrastructure/network/httpClientError.common.js.map +0 -1
- package/dist/infrastructure/network/httpClientError.error.d.ts.map +0 -1
- package/dist/infrastructure/network/httpClientError.error.js.map +0 -1
- package/dist/infrastructure/network/httpClientError.options.d.ts.map +0 -1
- package/dist/infrastructure/network/httpClientError.options.js.map +0 -1
- package/dist/infrastructure/network/httpClientError.specialized.d.ts.map +0 -1
- package/dist/infrastructure/network/httpClientError.specialized.js.map +0 -1
- package/dist/infrastructure/network/httpClientError.types.d.ts.map +0 -1
- package/dist/infrastructure/network/httpClientError.types.js.map +0 -1
- package/dist/infrastructure/network/httpError.base.d.ts.map +0 -1
- package/dist/infrastructure/network/httpError.base.js.map +0 -1
- package/dist/infrastructure/network/httpError.helpers.d.ts.map +0 -1
- package/dist/infrastructure/network/httpError.helpers.js.map +0 -1
- package/dist/infrastructure/network/httpResponse.error.d.ts.map +0 -1
- package/dist/infrastructure/network/httpResponse.error.js.map +0 -1
- package/dist/infrastructure/network/httpRouter.error.d.ts.map +0 -1
- package/dist/infrastructure/network/httpRouter.error.js.map +0 -1
- package/dist/infrastructure/network/httpRouterError.base.d.ts.map +0 -1
- package/dist/infrastructure/network/httpRouterError.base.js.map +0 -1
- package/dist/infrastructure/network/httpRouterError.types.d.ts.map +0 -1
- package/dist/infrastructure/network/httpRouterError.types.js.map +0 -1
- package/dist/infrastructure/network/httpServerError.error.d.ts.map +0 -1
- package/dist/infrastructure/network/httpServerError.error.js.map +0 -1
- package/dist/infrastructure/network/httpServerLifecycle.error.d.ts.map +0 -1
- package/dist/infrastructure/network/httpServerLifecycle.error.js.map +0 -1
- package/dist/infrastructure/network/httpServerLifecycleError.base.d.ts.map +0 -1
- package/dist/infrastructure/network/httpServerLifecycleError.base.js.map +0 -1
- package/dist/infrastructure/network/httpServerLifecycleError.types.d.ts.map +0 -1
- package/dist/infrastructure/network/httpServerLifecycleError.types.js.map +0 -1
- package/dist/infrastructure/network/httpStream.error.d.ts.map +0 -1
- package/dist/infrastructure/network/httpStream.error.js.map +0 -1
- package/dist/infrastructure/network/index.d.ts.map +0 -1
- package/dist/infrastructure/network/index.js.map +0 -1
- package/dist/infrastructure/network/network.error.d.ts.map +0 -1
- package/dist/infrastructure/network/network.error.js.map +0 -1
- package/dist/infrastructure/network/networkError.base.d.ts.map +0 -1
- package/dist/infrastructure/network/networkError.base.js.map +0 -1
- package/dist/infrastructure/network/networkError.factory.d.ts.map +0 -1
- package/dist/infrastructure/network/networkError.factory.js.map +0 -1
- package/dist/infrastructure/network/routePattern.error.d.ts.map +0 -1
- package/dist/infrastructure/network/routePattern.error.js.map +0 -1
- package/dist/infrastructure/network/timeout.error.d.ts.map +0 -1
- package/dist/infrastructure/network/timeout.error.js.map +0 -1
- package/dist/infrastructure/network/timeoutError.base.d.ts.map +0 -1
- package/dist/infrastructure/network/timeoutError.base.js.map +0 -1
- package/dist/infrastructure/network/timeoutError.factory.d.ts.map +0 -1
- package/dist/infrastructure/network/timeoutError.factory.js.map +0 -1
- package/dist/infrastructure/service/externalService.error.d.ts.map +0 -1
- package/dist/infrastructure/service/externalService.error.js.map +0 -1
- package/dist/infrastructure/service/externalServiceError.base.d.ts.map +0 -1
- package/dist/infrastructure/service/externalServiceError.base.js.map +0 -1
- package/dist/infrastructure/service/externalServiceError.factory.d.ts.map +0 -1
- package/dist/infrastructure/service/externalServiceError.factory.js.map +0 -1
- package/dist/infrastructure/service/index.d.ts.map +0 -1
- package/dist/infrastructure/service/index.js.map +0 -1
- package/dist/infrastructure/service/service.error.d.ts.map +0 -1
- package/dist/infrastructure/service/service.error.js.map +0 -1
- package/dist/infrastructure/service/serviceError.base.d.ts.map +0 -1
- package/dist/infrastructure/service/serviceError.base.js.map +0 -1
- package/dist/infrastructure/service/serviceError.factory.d.ts.map +0 -1
- package/dist/infrastructure/service/serviceError.factory.js.map +0 -1
- package/dist/infrastructure/storage/database.error.d.ts.map +0 -1
- package/dist/infrastructure/storage/database.error.js.map +0 -1
- package/dist/infrastructure/storage/databaseError.base.d.ts.map +0 -1
- package/dist/infrastructure/storage/databaseError.base.js.map +0 -1
- package/dist/infrastructure/storage/databaseError.factory.d.ts.map +0 -1
- package/dist/infrastructure/storage/databaseError.factory.js.map +0 -1
- package/dist/infrastructure/storage/index.d.ts.map +0 -1
- package/dist/infrastructure/storage/index.js.map +0 -1
- package/dist/infrastructure/storage/storage.error.d.ts.map +0 -1
- package/dist/infrastructure/storage/storage.error.js.map +0 -1
- package/dist/infrastructure/storage/storageError.base.d.ts.map +0 -1
- package/dist/infrastructure/storage/storageError.base.js.map +0 -1
- package/dist/infrastructure/storage/storageError.factory.d.ts.map +0 -1
- package/dist/infrastructure/storage/storageError.factory.js.map +0 -1
- package/dist/system/crypto.error.d.ts.map +0 -1
- package/dist/system/crypto.error.js.map +0 -1
- package/dist/system/cryptoError.base.d.ts.map +0 -1
- package/dist/system/cryptoError.base.js.map +0 -1
- package/dist/system/cryptoError.factory.d.ts.map +0 -1
- package/dist/system/cryptoError.factory.js.map +0 -1
- package/dist/system/index.d.ts.map +0 -1
- package/dist/system/index.js.map +0 -1
- package/dist/system/logging/index.d.ts.map +0 -1
- package/dist/system/logging/index.js.map +0 -1
- package/dist/system/logging/logging.error.d.ts.map +0 -1
- package/dist/system/logging/logging.error.js.map +0 -1
- package/dist/system/runtime.error.d.ts.map +0 -1
- package/dist/system/runtime.error.js.map +0 -1
- package/dist/system/runtimeError.base.d.ts.map +0 -1
- package/dist/system/runtimeError.base.js.map +0 -1
- package/dist/system/runtimeError.types.d.ts.map +0 -1
- package/dist/system/runtimeError.types.js.map +0 -1
- package/dist/system/system.error.d.ts.map +0 -1
- package/dist/system/system.error.js.map +0 -1
- package/dist/system/systemError.base.d.ts.map +0 -1
- package/dist/system/systemError.base.js.map +0 -1
- package/dist/system/systemError.factory.d.ts.map +0 -1
- package/dist/system/systemError.factory.js.map +0 -1
- package/dist/utils/errorHandler.core.d.ts.map +0 -1
- package/dist/utils/errorHandler.core.js.map +0 -1
- package/dist/utils/errorHandler.factory.d.ts.map +0 -1
- package/dist/utils/errorHandler.factory.js.map +0 -1
- package/dist/utils/errorHandler.types.d.ts.map +0 -1
- package/dist/utils/errorHandler.types.js.map +0 -1
- package/dist/utils/errorMapper.core.d.ts.map +0 -1
- package/dist/utils/errorMapper.core.js.map +0 -1
- package/dist/utils/errorMapper.mappers.d.ts.map +0 -1
- package/dist/utils/errorMapper.mappers.js.map +0 -1
- package/dist/utils/errorMapper.registry.d.ts.map +0 -1
- package/dist/utils/errorMapper.registry.js.map +0 -1
- package/dist/utils/errorMapper.types.d.ts.map +0 -1
- package/dist/utils/errorMapper.types.js.map +0 -1
- package/dist/utils/errorSerializer.core.d.ts.map +0 -1
- package/dist/utils/errorSerializer.core.js.map +0 -1
- package/dist/utils/errorSerializer.factory.d.ts.map +0 -1
- package/dist/utils/errorSerializer.factory.js.map +0 -1
- package/dist/utils/errorSerializer.types.d.ts.map +0 -1
- package/dist/utils/errorSerializer.types.js.map +0 -1
- package/dist/utils/errorUtils.extraction.d.ts.map +0 -1
- package/dist/utils/errorUtils.extraction.js.map +0 -1
- package/dist/utils/errorUtils.helper.d.ts.map +0 -1
- package/dist/utils/errorUtils.helper.js.map +0 -1
- package/dist/utils/errorUtils.transform.d.ts.map +0 -1
- package/dist/utils/errorUtils.transform.js.map +0 -1
- package/dist/utils/errorUtils.typeCheck.d.ts.map +0 -1
- package/dist/utils/errorUtils.typeCheck.js.map +0 -1
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/index.js.map +0 -1
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { BaseErrorOptions } from "../../base/types/baseError.type.js";
|
|
3
|
-
import { ErrorCategory } from "../../base/types/errorCategory.type.js";
|
|
1
|
+
import { HttpRouterError, type HttpRouterErrorOptions } from "./httpRouterError.base.js";
|
|
4
2
|
/**
|
|
5
3
|
* Options for creating a route pattern error.
|
|
6
4
|
*/
|
|
7
|
-
export interface RoutePatternErrorOptions extends
|
|
8
|
-
readonly category?: ErrorCategory;
|
|
5
|
+
export interface RoutePatternErrorOptions extends HttpRouterErrorOptions {
|
|
9
6
|
readonly pattern?: string;
|
|
10
7
|
readonly position?: number;
|
|
11
8
|
}
|
|
12
9
|
/**
|
|
13
10
|
* Error thrown when a route pattern is invalid.
|
|
11
|
+
*
|
|
12
|
+
* Route patterns are authored by developers, not clients, so this is a
|
|
13
|
+
* server-side configuration error: 500, not exposed, non-operational.
|
|
14
|
+
* `InvalidRoutePatternError` (in `httpRouterError.types`) extends this class.
|
|
14
15
|
*/
|
|
15
|
-
export declare class RoutePatternError extends
|
|
16
|
+
export declare class RoutePatternError extends HttpRouterError {
|
|
16
17
|
/**
|
|
17
18
|
* The route pattern that caused the error.
|
|
18
19
|
*/
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import { BaseError } from "../../base/core/baseError.core.js";
|
|
2
1
|
import { ErrorCode } from "../../base/types/errorCode.type.js";
|
|
3
|
-
import { ErrorCategory } from "../../base/types/errorCategory.type.js";
|
|
4
2
|
import { ErrorSeverity } from "../../base/types/errorSeverity.type.js";
|
|
3
|
+
import { HttpRouterError, } from "./httpRouterError.base.js";
|
|
5
4
|
/**
|
|
6
5
|
* Error thrown when a route pattern is invalid.
|
|
6
|
+
*
|
|
7
|
+
* Route patterns are authored by developers, not clients, so this is a
|
|
8
|
+
* server-side configuration error: 500, not exposed, non-operational.
|
|
9
|
+
* `InvalidRoutePatternError` (in `httpRouterError.types`) extends this class.
|
|
7
10
|
*/
|
|
8
|
-
export class RoutePatternError extends
|
|
11
|
+
export class RoutePatternError extends HttpRouterError {
|
|
9
12
|
/**
|
|
10
13
|
* The route pattern that caused the error.
|
|
11
14
|
*/
|
|
@@ -18,12 +21,18 @@ export class RoutePatternError extends BaseError {
|
|
|
18
21
|
super(message, {
|
|
19
22
|
...options,
|
|
20
23
|
code: options.code ?? ErrorCode.HTTP_ROUTE_PATTERN,
|
|
21
|
-
category: options.category ?? ErrorCategory.VALIDATION,
|
|
22
24
|
severity: options.severity ?? ErrorSeverity.ERROR,
|
|
23
|
-
statusCode: options.statusCode ??
|
|
24
|
-
expose: options.expose ??
|
|
25
|
+
statusCode: options.statusCode ?? 500,
|
|
26
|
+
expose: options.expose ?? false,
|
|
27
|
+
isOperational: options.isOperational ?? false,
|
|
28
|
+
metadata: {
|
|
29
|
+
...options.metadata,
|
|
30
|
+
...(options.pattern !== undefined ? { pattern: options.pattern } : {}),
|
|
31
|
+
...(options.position !== undefined
|
|
32
|
+
? { position: options.position }
|
|
33
|
+
: {}),
|
|
34
|
+
},
|
|
25
35
|
});
|
|
26
|
-
this.name = "RoutePatternError";
|
|
27
36
|
this.pattern = options.pattern ?? "";
|
|
28
37
|
this.position = options.position;
|
|
29
38
|
}
|
|
@@ -44,7 +53,6 @@ export class DuplicateRouteParameterError extends RoutePatternError {
|
|
|
44
53
|
paramName,
|
|
45
54
|
},
|
|
46
55
|
});
|
|
47
|
-
this.name = "DuplicateRouteParameterError";
|
|
48
56
|
this.paramName = paramName;
|
|
49
57
|
}
|
|
50
58
|
}
|
|
@@ -51,4 +51,11 @@ export declare class TimeoutError extends BaseError {
|
|
|
51
51
|
export declare function createTimeoutError(message?: string, options?: TimeoutErrorOptions): TimeoutError;
|
|
52
52
|
/** Determines whether an unknown value is a TimeoutError. */
|
|
53
53
|
export declare function isTimeoutError(value: unknown): value is TimeoutError;
|
|
54
|
+
/**
|
|
55
|
+
* Returns whether a timeout operation may expose its message (and target) to
|
|
56
|
+
* clients. Only request-level timeouts are public by default; database,
|
|
57
|
+
* cache, queue, lock, network and external-service timeouts describe internal
|
|
58
|
+
* resources and stay internal.
|
|
59
|
+
*/
|
|
60
|
+
export declare function isPublicTimeoutOperation(operation: TimeoutOperation | undefined): boolean;
|
|
54
61
|
//# sourceMappingURL=timeoutError.base.d.ts.map
|
|
@@ -31,7 +31,7 @@ export class TimeoutError extends BaseError {
|
|
|
31
31
|
category: options.category ?? ErrorCategory.TIMEOUT,
|
|
32
32
|
severity: options.severity ?? ErrorSeverity.WARNING,
|
|
33
33
|
statusCode: options.statusCode ?? 504,
|
|
34
|
-
expose: options.expose ??
|
|
34
|
+
expose: options.expose ?? isPublicTimeoutOperation(options.operation),
|
|
35
35
|
isOperational: options.isOperational ?? true,
|
|
36
36
|
metadata: {
|
|
37
37
|
...options.metadata,
|
|
@@ -65,6 +65,17 @@ export function createTimeoutError(message = "The operation timed out.", options
|
|
|
65
65
|
export function isTimeoutError(value) {
|
|
66
66
|
return value instanceof TimeoutError;
|
|
67
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* Returns whether a timeout operation may expose its message (and target) to
|
|
70
|
+
* clients. Only request-level timeouts are public by default; database,
|
|
71
|
+
* cache, queue, lock, network and external-service timeouts describe internal
|
|
72
|
+
* resources and stay internal.
|
|
73
|
+
*/
|
|
74
|
+
export function isPublicTimeoutOperation(operation) {
|
|
75
|
+
return (operation === undefined ||
|
|
76
|
+
operation === TimeoutOperation.UNKNOWN ||
|
|
77
|
+
operation === TimeoutOperation.REQUEST);
|
|
78
|
+
}
|
|
68
79
|
/** Validates a timeout duration. */
|
|
69
80
|
function validateTimeout(timeoutMs) {
|
|
70
81
|
if (timeoutMs === undefined) {
|
|
@@ -1,13 +1,27 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Timeout error factory functions for specific operations.
|
|
3
|
+
*
|
|
4
|
+
* Every factory accepts either an options object `{ timeoutMs, target }` or
|
|
5
|
+
* the legacy positional arguments. The positional order differs between the
|
|
6
|
+
* request/database factories (`timeoutMs, target`) and the service/lock
|
|
7
|
+
* factories (`target, timeoutMs`); the object form is recommended.
|
|
3
8
|
*/
|
|
4
9
|
import { TimeoutError } from "./timeoutError.base.js";
|
|
10
|
+
/** Arguments shared by the timeout factories. */
|
|
11
|
+
export interface TimeoutFactoryOptions {
|
|
12
|
+
readonly timeoutMs?: number;
|
|
13
|
+
readonly target?: string;
|
|
14
|
+
}
|
|
5
15
|
/** Creates a request timeout error. */
|
|
16
|
+
export declare function requestTimeoutError(options?: TimeoutFactoryOptions): TimeoutError;
|
|
6
17
|
export declare function requestTimeoutError(timeoutMs?: number, target?: string): TimeoutError;
|
|
7
18
|
/** Creates a database timeout error. */
|
|
19
|
+
export declare function databaseTimeoutError(options?: TimeoutFactoryOptions): TimeoutError;
|
|
8
20
|
export declare function databaseTimeoutError(timeoutMs?: number, target?: string): TimeoutError;
|
|
9
21
|
/** Creates an external-service timeout error. */
|
|
22
|
+
export declare function serviceTimeoutError(options?: TimeoutFactoryOptions): TimeoutError;
|
|
10
23
|
export declare function serviceTimeoutError(target?: string, timeoutMs?: number): TimeoutError;
|
|
11
24
|
/** Creates a lock acquisition timeout error. */
|
|
25
|
+
export declare function lockTimeoutError(options?: TimeoutFactoryOptions): TimeoutError;
|
|
12
26
|
export declare function lockTimeoutError(target?: string, timeoutMs?: number): TimeoutError;
|
|
13
27
|
//# sourceMappingURL=timeoutError.factory.d.ts.map
|
|
@@ -1,11 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Timeout error factory functions for specific operations.
|
|
3
|
+
*
|
|
4
|
+
* Every factory accepts either an options object `{ timeoutMs, target }` or
|
|
5
|
+
* the legacy positional arguments. The positional order differs between the
|
|
6
|
+
* request/database factories (`timeoutMs, target`) and the service/lock
|
|
7
|
+
* factories (`target, timeoutMs`); the object form is recommended.
|
|
3
8
|
*/
|
|
4
9
|
import { ErrorCategory } from "../../base/types/errorCategory.type.js";
|
|
5
10
|
import { ErrorCode } from "../../base/types/errorCode.type.js";
|
|
6
11
|
import { TimeoutError, TimeoutOperation } from "./timeoutError.base.js";
|
|
7
|
-
|
|
8
|
-
|
|
12
|
+
function resolveTimeoutArgs(first, second, order) {
|
|
13
|
+
if (first !== undefined && typeof first === "object")
|
|
14
|
+
return first;
|
|
15
|
+
const [timeoutMs, target] = order === "timeoutFirst" ? [first, second] : [second, first];
|
|
16
|
+
return {
|
|
17
|
+
...(typeof timeoutMs === "number" ? { timeoutMs } : {}),
|
|
18
|
+
...(typeof target === "string" ? { target } : {}),
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export function requestTimeoutError(first, second) {
|
|
22
|
+
const { timeoutMs, target } = resolveTimeoutArgs(first, second, "timeoutFirst");
|
|
9
23
|
return new TimeoutError(target ? `The request to ${target} timed out.` : "The request timed out.", {
|
|
10
24
|
code: ErrorCode.TIMEOUT,
|
|
11
25
|
operation: TimeoutOperation.REQUEST,
|
|
@@ -13,11 +27,9 @@ export function requestTimeoutError(timeoutMs, target) {
|
|
|
13
27
|
target,
|
|
14
28
|
});
|
|
15
29
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return new TimeoutError(
|
|
19
|
-
? `The database operation on ${target} timed out.`
|
|
20
|
-
: "The database operation timed out.", {
|
|
30
|
+
export function databaseTimeoutError(first, second) {
|
|
31
|
+
const { timeoutMs, target } = resolveTimeoutArgs(first, second, "timeoutFirst");
|
|
32
|
+
return new TimeoutError("The database operation timed out.", {
|
|
21
33
|
code: ErrorCode.DATABASE_TIMEOUT,
|
|
22
34
|
category: ErrorCategory.DATABASE,
|
|
23
35
|
operation: TimeoutOperation.DATABASE,
|
|
@@ -25,11 +37,9 @@ export function databaseTimeoutError(timeoutMs, target) {
|
|
|
25
37
|
target,
|
|
26
38
|
});
|
|
27
39
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return new TimeoutError(
|
|
31
|
-
? `The request to ${target} timed out.`
|
|
32
|
-
: "The external service request timed out.", {
|
|
40
|
+
export function serviceTimeoutError(first, second) {
|
|
41
|
+
const { timeoutMs, target } = resolveTimeoutArgs(first, second, "targetFirst");
|
|
42
|
+
return new TimeoutError("The external service request timed out.", {
|
|
33
43
|
code: ErrorCode.EXTERNAL_SERVICE_TIMEOUT,
|
|
34
44
|
category: ErrorCategory.EXTERNAL_SERVICE,
|
|
35
45
|
operation: TimeoutOperation.EXTERNAL_SERVICE,
|
|
@@ -37,11 +47,9 @@ export function serviceTimeoutError(target, timeoutMs) {
|
|
|
37
47
|
target,
|
|
38
48
|
});
|
|
39
49
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
return new TimeoutError(
|
|
43
|
-
? `Timed out while waiting for lock "${target}".`
|
|
44
|
-
: "Timed out while waiting for a lock.", {
|
|
50
|
+
export function lockTimeoutError(first, second) {
|
|
51
|
+
const { timeoutMs, target } = resolveTimeoutArgs(first, second, "targetFirst");
|
|
52
|
+
return new TimeoutError("Timed out while waiting for a lock.", {
|
|
45
53
|
code: ErrorCode.LOCK_TIMEOUT,
|
|
46
54
|
category: ErrorCategory.CONFLICT,
|
|
47
55
|
operation: TimeoutOperation.LOCK,
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export { ExternalServiceError, createExternalServiceError, isExternalServiceError, } from "./externalServiceError.base.js";
|
|
5
5
|
export type { ExternalServiceErrorOptions } from "./externalServiceError.base.js";
|
|
6
|
-
export { externalServiceTimeoutError, externalServiceUnavailable, } from "./externalServiceError.factory.js";
|
|
6
|
+
export { externalServiceTimeoutError, externalServiceUnavailable, externalServiceUnavailableError, } from "./externalServiceError.factory.js";
|
|
7
7
|
//# sourceMappingURL=externalService.error.d.ts.map
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
* External service error classes — re-exports from focused files.
|
|
3
3
|
*/
|
|
4
4
|
export { ExternalServiceError, createExternalServiceError, isExternalServiceError, } from "./externalServiceError.base.js";
|
|
5
|
-
export { externalServiceTimeoutError, externalServiceUnavailable, } from "./externalServiceError.factory.js";
|
|
5
|
+
export { externalServiceTimeoutError, externalServiceUnavailable, externalServiceUnavailableError, } from "./externalServiceError.factory.js";
|
|
6
6
|
//# sourceMappingURL=externalService.error.js.map
|
|
@@ -42,4 +42,12 @@ export declare class ExternalServiceError extends BaseError {
|
|
|
42
42
|
export declare function createExternalServiceError(service: string, message?: string, options?: Omit<ExternalServiceErrorOptions, "service">): ExternalServiceError;
|
|
43
43
|
/** Determines whether an unknown value is an ExternalServiceError. */
|
|
44
44
|
export declare function isExternalServiceError(value: unknown): value is ExternalServiceError;
|
|
45
|
+
/**
|
|
46
|
+
* Maps a remote response status into an appropriate local HTTP status.
|
|
47
|
+
*
|
|
48
|
+
* An upstream failure is our problem, not our caller's: every upstream status
|
|
49
|
+
* maps to 502 Bad Gateway except 429, which is passed through so that callers
|
|
50
|
+
* can back off. Pass an explicit `statusCode` option to override.
|
|
51
|
+
*/
|
|
52
|
+
export declare function mapResponseStatus(responseStatus: number | undefined): number;
|
|
45
53
|
//# sourceMappingURL=externalServiceError.base.d.ts.map
|
|
@@ -61,20 +61,17 @@ export function createExternalServiceError(service, message = "An external servi
|
|
|
61
61
|
export function isExternalServiceError(value) {
|
|
62
62
|
return value instanceof ExternalServiceError;
|
|
63
63
|
}
|
|
64
|
-
/**
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
64
|
+
/**
|
|
65
|
+
* Maps a remote response status into an appropriate local HTTP status.
|
|
66
|
+
*
|
|
67
|
+
* An upstream failure is our problem, not our caller's: every upstream status
|
|
68
|
+
* maps to 502 Bad Gateway except 429, which is passed through so that callers
|
|
69
|
+
* can back off. Pass an explicit `statusCode` option to override.
|
|
70
|
+
*/
|
|
71
|
+
export function mapResponseStatus(responseStatus) {
|
|
72
72
|
if (responseStatus === 429) {
|
|
73
73
|
return 429;
|
|
74
74
|
}
|
|
75
|
-
if (responseStatus >= 400) {
|
|
76
|
-
return responseStatus;
|
|
77
|
-
}
|
|
78
75
|
return 502;
|
|
79
76
|
}
|
|
80
77
|
//# sourceMappingURL=externalServiceError.base.js.map
|
|
@@ -5,5 +5,7 @@ import { ExternalServiceError } from "./externalServiceError.base.js";
|
|
|
5
5
|
/** Creates an external service timeout error. */
|
|
6
6
|
export declare function externalServiceTimeoutError(service: string, operation?: string): ExternalServiceError;
|
|
7
7
|
/** Creates an external service unavailable error. */
|
|
8
|
-
export declare function
|
|
8
|
+
export declare function externalServiceUnavailableError(service: string, operation?: string): ExternalServiceError;
|
|
9
|
+
/** @deprecated Use `externalServiceUnavailableError`. */
|
|
10
|
+
export declare const externalServiceUnavailable: typeof externalServiceUnavailableError;
|
|
9
11
|
//# sourceMappingURL=externalServiceError.factory.d.ts.map
|
|
@@ -18,7 +18,7 @@ export function externalServiceTimeoutError(service, operation) {
|
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
20
|
/** Creates an external service unavailable error. */
|
|
21
|
-
export function
|
|
21
|
+
export function externalServiceUnavailableError(service, operation) {
|
|
22
22
|
return new ExternalServiceError(`${service} is currently unavailable.`, {
|
|
23
23
|
service,
|
|
24
24
|
operation,
|
|
@@ -29,4 +29,6 @@ export function externalServiceUnavailable(service, operation) {
|
|
|
29
29
|
expose: false,
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
|
+
/** @deprecated Use `externalServiceUnavailableError`. */
|
|
33
|
+
export const externalServiceUnavailable = externalServiceUnavailableError;
|
|
32
34
|
//# sourceMappingURL=externalServiceError.factory.js.map
|
|
@@ -31,7 +31,7 @@ export function databaseTransactionError(message = "The database transaction fai
|
|
|
31
31
|
export function databaseMigrationError(message = "The database migration failed.", options = {}) {
|
|
32
32
|
return new DatabaseError(message, {
|
|
33
33
|
...options,
|
|
34
|
-
code: ErrorCode.
|
|
34
|
+
code: ErrorCode.DATABASE_MIGRATION,
|
|
35
35
|
operation: DatabaseOperation.MIGRATION,
|
|
36
36
|
});
|
|
37
37
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Storage error factory functions.
|
|
3
3
|
*/
|
|
4
4
|
import { ErrorCode } from "../../base/types/errorCode.type.js";
|
|
5
|
-
import { StorageError, StorageOperation
|
|
5
|
+
import { StorageError, StorageOperation } from "./storageError.base.js";
|
|
6
6
|
/** Creates a storage read error. */
|
|
7
7
|
export function storageReadError(resource, provider, cause) {
|
|
8
8
|
return new StorageError(`Failed to read "${resource}".`, {
|
|
@@ -56,7 +56,7 @@ export function storageDeleteError(resource, provider, cause) {
|
|
|
56
56
|
/** Creates a storage not found error. */
|
|
57
57
|
export function storageNotFoundError(resource, provider) {
|
|
58
58
|
return new StorageError(`Resource "${resource}" was not found.`, {
|
|
59
|
-
code: ErrorCode.
|
|
59
|
+
code: ErrorCode.STORAGE_NOT_FOUND,
|
|
60
60
|
operation: StorageOperation.READ,
|
|
61
61
|
provider,
|
|
62
62
|
resource,
|
|
@@ -20,8 +20,11 @@ export function cryptoCipherError(message = "Cryptographic encryption or decrypt
|
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
22
|
/** Creates a cryptographic signature error. */
|
|
23
|
-
export function cryptoSignatureError(message
|
|
24
|
-
|
|
23
|
+
export function cryptoSignatureError(message, operation = CryptoOperation.VERIFY_SIGNATURE, algorithm) {
|
|
24
|
+
const defaultMessage = operation === CryptoOperation.SIGN
|
|
25
|
+
? "Cryptographic signing failed."
|
|
26
|
+
: "Cryptographic signature verification failed.";
|
|
27
|
+
return new CryptoError(message ?? defaultMessage, {
|
|
25
28
|
code: ErrorCode.CRYPTO_SIGNATURE,
|
|
26
29
|
operation,
|
|
27
30
|
algorithm,
|
|
@@ -11,7 +11,7 @@ export class RuntimeError extends BaseError {
|
|
|
11
11
|
constructor(message, options = {}) {
|
|
12
12
|
super(message, {
|
|
13
13
|
...options,
|
|
14
|
-
code: options.code ?? ErrorCode.
|
|
14
|
+
code: options.code ?? ErrorCode.RUNTIME,
|
|
15
15
|
category: options.category ?? ErrorCategory.RUNTIME,
|
|
16
16
|
severity: options.severity ?? ErrorSeverity.ERROR,
|
|
17
17
|
statusCode: options.statusCode ?? 500,
|
|
@@ -1,30 +1,64 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Centralized error normalization, serialization, and reporting service.
|
|
3
3
|
*/
|
|
4
|
-
import { BaseError } from "../base/core/baseError.core.js";
|
|
5
|
-
import type { ErrorHandlerOptions, ErrorHandlerResult, ErrorHandlerContext, NormalizedError } from "./errorHandler.types.js";
|
|
6
|
-
export type { ErrorHandlerOptions, ErrorHandlerResult, ErrorHandlerContext, ErrorReporter, NormalizedError, } from "./errorHandler.types.js";
|
|
4
|
+
import type { BaseError } from "../base/core/baseError.core.js";
|
|
5
|
+
import type { ErrorHandlerOptions, ErrorHandlerResult, ErrorHandlerContext, NormalizedError, PublicErrorHandlerResult } from "./errorHandler.types.js";
|
|
6
|
+
export type { ErrorHandlerOptions, ErrorHandlerResult, ErrorHandlerContext, ErrorReporter, ErrorReporterFailureHandler, NormalizedError, PublicErrorHandlerResult, } from "./errorHandler.types.js";
|
|
7
7
|
export { createErrorHandler, normalizeError, isHandledError, } from "./errorHandler.factory.js";
|
|
8
8
|
/** Centralized error normalization, serialization, and reporting service. */
|
|
9
9
|
export declare class ErrorHandler {
|
|
10
10
|
private readonly reporter?;
|
|
11
|
+
private readonly onReporterError?;
|
|
11
12
|
private readonly defaultStatusCode;
|
|
12
13
|
private readonly defaultMessage;
|
|
13
14
|
private readonly includeStack;
|
|
15
|
+
private readonly publicMetadataKeys;
|
|
16
|
+
private readonly sensitiveKeyPattern;
|
|
14
17
|
constructor(options?: ErrorHandlerOptions);
|
|
15
18
|
/** Converts an unknown thrown value into a BaseError. */
|
|
16
19
|
normalize(value: unknown): NormalizedError;
|
|
17
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* Handles and normalizes an unknown error.
|
|
22
|
+
*
|
|
23
|
+
* The reporter is isolated: if it throws or rejects, the failure is passed
|
|
24
|
+
* to `onReporterError` (or swallowed) and the original error's result is
|
|
25
|
+
* still returned.
|
|
26
|
+
*/
|
|
18
27
|
handle(value: unknown, context?: ErrorHandlerContext): Promise<ErrorHandlerResult>;
|
|
19
|
-
/**
|
|
28
|
+
/** Handles an unknown error and returns the client-safe representation. */
|
|
29
|
+
handlePublic(value: unknown, context?: ErrorHandlerContext): Promise<PublicErrorHandlerResult>;
|
|
30
|
+
/**
|
|
31
|
+
* Converts a BaseError into the internal result object.
|
|
32
|
+
*
|
|
33
|
+
* Metadata is redacted recursively; the stack is never included.
|
|
34
|
+
*/
|
|
20
35
|
toResult(error: BaseError, context?: ErrorHandlerContext): ErrorHandlerResult;
|
|
36
|
+
/**
|
|
37
|
+
* Converts a BaseError into a client-safe result.
|
|
38
|
+
*
|
|
39
|
+
* Only `code`, `message`, `statusCode`, request/correlation ids and
|
|
40
|
+
* allow-listed metadata (`details`) are included. Internal classification
|
|
41
|
+
* fields and non-exposed metadata are never revealed.
|
|
42
|
+
*/
|
|
43
|
+
toPublicResult(error: BaseError, context?: ErrorHandlerContext): PublicErrorHandlerResult;
|
|
21
44
|
/** Reports an error without producing a response. */
|
|
22
45
|
report(value: unknown, context?: ErrorHandlerContext): Promise<BaseError>;
|
|
23
46
|
/** Determines whether an error should expose its message to clients. */
|
|
24
47
|
shouldExpose(error: BaseError): boolean;
|
|
25
|
-
/**
|
|
48
|
+
/**
|
|
49
|
+
* Returns a safe serialized error representation (never includes a stack).
|
|
50
|
+
*
|
|
51
|
+
* Equivalent to `toPublicResult`; kept for backwards compatibility.
|
|
52
|
+
*/
|
|
26
53
|
serialize(error: BaseError, context?: ErrorHandlerContext): Record<string, unknown>;
|
|
27
|
-
/**
|
|
28
|
-
|
|
54
|
+
/**
|
|
55
|
+
* Returns the full internal representation for logging, including the
|
|
56
|
+
* (redacted) cause chain and, when `includeStack` is enabled, stack traces.
|
|
57
|
+
*/
|
|
58
|
+
toLogObject(error: BaseError, context?: ErrorHandlerContext): Record<string, unknown>;
|
|
59
|
+
/** Invokes the reporter without letting its failure escape. */
|
|
60
|
+
private reportSafely;
|
|
61
|
+
/** Removes obviously sensitive fields from metadata (recursively). */
|
|
62
|
+
private redact;
|
|
29
63
|
}
|
|
30
64
|
//# sourceMappingURL=errorHandler.core.d.ts.map
|