mirror of
https://github.com/hanzoai/tasks.git
synced 2026-10-04 02:04:03 +00:00
## What changed? Refactor: use new `serviceerror.New...f` constructors. ## Why? Most of service errors now supports `fmt.Sprintf` format and they should be used instead of `fmt.Sprintf`. ## How did you test it? - [ ] built - [ ] run locally and tested manually - [x] covered by existing tests - [ ] added new unit test(s) - [ ] added new functional test(s)
44 lines
1.3 KiB
Go
44 lines
1.3 KiB
Go
package persistence
|
|
|
|
import (
|
|
"go.temporal.io/api/serviceerror"
|
|
)
|
|
|
|
const (
|
|
QueueTypeUnspecified QueueV2Type = 0
|
|
QueueTypeHistoryNormal QueueV2Type = 1
|
|
QueueTypeHistoryDLQ QueueV2Type = 2
|
|
|
|
// FirstQueueMessageID is the ID of the first message written to a queue partition.
|
|
FirstQueueMessageID = 0
|
|
)
|
|
|
|
var (
|
|
ErrInvalidReadQueueMessagesNextPageToken = &InvalidPersistenceRequestError{
|
|
Msg: "invalid next-page token for reading queue messages",
|
|
}
|
|
ErrInvalidListQueuesNextPageToken = &InvalidPersistenceRequestError{
|
|
Msg: "invalid next-page token for listing queues",
|
|
}
|
|
ErrNonPositiveReadQueueMessagesPageSize = &InvalidPersistenceRequestError{
|
|
Msg: "non-positive page size for reading queue messages",
|
|
}
|
|
ErrInvalidQueueRangeDeleteMaxMessageID = &InvalidPersistenceRequestError{
|
|
Msg: "max message id for queue range delete is invalid",
|
|
}
|
|
ErrNonPositiveListQueuesPageSize = &InvalidPersistenceRequestError{
|
|
Msg: "non-positive page size for listing queues",
|
|
}
|
|
ErrNegativeListQueuesOffset = &InvalidPersistenceRequestError{
|
|
Msg: "negative offset for listing queues",
|
|
}
|
|
)
|
|
|
|
func NewQueueNotFoundError(queueType QueueV2Type, queueName string) error {
|
|
return serviceerror.NewNotFoundf(
|
|
"queue not found: type = %v and name = %v",
|
|
queueType,
|
|
queueName,
|
|
)
|
|
}
|