diff --git a/src/lib/message/_/_delete-message.ts b/src/lib/message/_/_delete-message.ts index a325e9a..05f7ed4 100644 --- a/src/lib/message/_/_delete-message.ts +++ b/src/lib/message/_/_delete-message.ts @@ -20,6 +20,7 @@ import { MessageError, MessageInvalidParametersError, MessageMessageInProcessError, + MessageMessageNotDeletedError, MessageMessageNotFoundError, } from '../errors/index.js'; import { EMessageProperty, EMessagePropertyStatus } from '../types/index.js'; @@ -99,7 +100,7 @@ export function _deleteMessage( } else if (reply === 'MESSAGE_IN_PROCESS') { cb(new MessageMessageInProcessError()); } else if (reply === 'MESSAGE_NOT_DELETED') { - cb(new MessageMessageNotFoundError()); + cb(new MessageMessageNotDeletedError()); } else if (reply === 'INVALID_PARAMETERS') { cb(new MessageInvalidParametersError()); } else { diff --git a/src/lib/message/errors/index.ts b/src/lib/message/errors/index.ts index d9b61a6..d07c2d2 100644 --- a/src/lib/message/errors/index.ts +++ b/src/lib/message/errors/index.ts @@ -16,3 +16,4 @@ export { MessageMessagePropertyError } from './message-message-property.error.js export { MessageMessageInProcessError } from './message-message-in-process.error.js'; export { MessageInvalidParametersError } from './message-invalid-parameters.error.js'; export { MessageMessageNotRequeuableError } from './message-message-not-requeuable.error.js'; +export { MessageMessageNotDeletedError } from './message-message-not-deleted.error.js'; diff --git a/src/lib/message/errors/message-message-not-deleted.error.ts b/src/lib/message/errors/message-message-not-deleted.error.ts new file mode 100644 index 0000000..ba17f91 --- /dev/null +++ b/src/lib/message/errors/message-message-not-deleted.error.ts @@ -0,0 +1,12 @@ +/* + * Copyright (c) + * Weyoss + * https://github.com/weyoss + * + * This source code is licensed under the MIT license found in the LICENSE file + * in the root directory of this source tree. + */ + +import { MessageError } from './message.error.js'; + +export class MessageMessageNotDeletedError extends MessageError {} diff --git a/src/lib/queue-messages/_/_validate-queue-extended-params.ts b/src/lib/queue-messages/_/_validate-queue-extended-params.ts index cf3a343..b374060 100644 --- a/src/lib/queue-messages/_/_validate-queue-extended-params.ts +++ b/src/lib/queue-messages/_/_validate-queue-extended-params.ts @@ -8,12 +8,10 @@ */ import { ICallback, IRedisClient } from 'redis-smq-common'; -import { - ConsumerConsumerGroupIdNotSupportedError, - ConsumerConsumerGroupIdRequiredError, -} from '../../consumer/index.js'; import { _getQueueProperties } from '../../queue/_/_get-queue-properties.js'; import { EQueueDeliveryModel, IQueueParsedParams } from '../../queue/index.js'; +import { QueueMessagesConsumerGroupIdNotSupportedError } from '../errors/queue-messages-consumer-group-id-not-supported.error.js'; +import { QueueMessagesConsumerGroupIdRequiredError } from '../errors/queue-messages-consumer-group-id-required.error.js'; export function _validateQueueExtendedParams( redisClient: IRedisClient, @@ -30,12 +28,12 @@ export function _validateQueueExtendedParams( properties?.deliveryModel === EQueueDeliveryModel.PUB_SUB && !groupId ) { - cb(new ConsumerConsumerGroupIdRequiredError()); + cb(new QueueMessagesConsumerGroupIdRequiredError()); } else if ( properties?.deliveryModel === EQueueDeliveryModel.POINT_TO_POINT && groupId ) { - cb(new ConsumerConsumerGroupIdNotSupportedError()); + cb(new QueueMessagesConsumerGroupIdNotSupportedError()); } else cb(); } }); diff --git a/src/lib/queue-messages/errors/index.ts b/src/lib/queue-messages/errors/index.ts index cfd2f13..1984481 100644 --- a/src/lib/queue-messages/errors/index.ts +++ b/src/lib/queue-messages/errors/index.ts @@ -8,3 +8,5 @@ */ export { QueueMessagesError } from './queue-messages.error.js'; +export { QueueMessagesConsumerGroupIdRequiredError } from './queue-messages-consumer-group-id-required.error.js'; +export { QueueMessagesConsumerGroupIdNotSupportedError } from './queue-messages-consumer-group-id-not-supported.error.js'; diff --git a/src/lib/queue-messages/errors/queue-messages-consumer-group-id-not-supported.error.ts b/src/lib/queue-messages/errors/queue-messages-consumer-group-id-not-supported.error.ts new file mode 100644 index 0000000..866aaaa --- /dev/null +++ b/src/lib/queue-messages/errors/queue-messages-consumer-group-id-not-supported.error.ts @@ -0,0 +1,12 @@ +/* + * Copyright (c) + * Weyoss + * https://github.com/weyoss + * + * This source code is licensed under the MIT license found in the LICENSE file + * in the root directory of this source tree. + */ + +import { QueueMessagesError } from './queue-messages.error.js'; + +export class QueueMessagesConsumerGroupIdNotSupportedError extends QueueMessagesError {} diff --git a/src/lib/queue-messages/errors/queue-messages-consumer-group-id-required.error.ts b/src/lib/queue-messages/errors/queue-messages-consumer-group-id-required.error.ts new file mode 100644 index 0000000..a66f3f4 --- /dev/null +++ b/src/lib/queue-messages/errors/queue-messages-consumer-group-id-required.error.ts @@ -0,0 +1,12 @@ +/* + * Copyright (c) + * Weyoss + * https://github.com/weyoss + * + * This source code is licensed under the MIT license found in the LICENSE file + * in the root directory of this source tree. + */ + +import { QueueMessagesError } from './queue-messages.error.js'; + +export class QueueMessagesConsumerGroupIdRequiredError extends QueueMessagesError {}