Skip to content

Commit

Permalink
Clarify commonly seen assertion because users need to register their …
Browse files Browse the repository at this point in the history
…tasks first
  • Loading branch information
Joannis committed Aug 25, 2023
1 parent 522d101 commit 806d55a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Sources/MongoQueue/MongoQueue.swift
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,10 @@ public final class MongoQueue {

/// Queues a task for execution. The task will be executed after the specified Date.
public func queueTask<T: _QueuedTask>(_ task: T) async throws {
assert(knownTypes.contains(where: { $0.category == T.category }))
assert(
knownTypes.contains(where: { $0.category == T.category }),
"Task `\(T.self)` is not a known type in MongoQueue. Did you forget to register it using `queue.registerTask`?"
)

let model = try TaskModel(representing: task)

Expand Down

0 comments on commit 806d55a

Please sign in to comment.