Better error message for pattern handler mismatches
This commit is contained in:
parent
d69af0a90d
commit
ec60d9c64a
|
@ -223,6 +223,7 @@ macro during*(turn: var Turn; ds: Ref; pattern: Pattern; publishBody: untyped) =
|
||||||
callbackProc = wrapDuringHandler(publishBody, nil)
|
callbackProc = wrapDuringHandler(publishBody, nil)
|
||||||
callbackSym = callbackProc[0]
|
callbackSym = callbackProc[0]
|
||||||
result = quote do:
|
result = quote do:
|
||||||
doAssert `pattern`.analyse.capturePaths.len == `argCount`, "mismatch between pattern capture and handler arguments"
|
doAssert `pattern`.analyse.capturePaths.len == `argCount`,
|
||||||
|
("capture path has " & $`pattern`.analyse.capturePaths.len & " args for " & $`pattern`)
|
||||||
`callbackProc`
|
`callbackProc`
|
||||||
discard observe(`turn`, `ds`, `pattern`, during(`callbackSym`))
|
discard observe(`turn`, `ds`, `pattern`, during(`callbackSym`))
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# SPDX-FileCopyrightText: ☭ 2022 Emery Hemingway
|
# SPDX-FileCopyrightText: ☭ 2022 Emery Hemingway
|
||||||
# SPDX-License-Identifier: Unlicense
|
# SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
import std/[hashes, options, tables]
|
import std/[hashes, tables]
|
||||||
|
|
||||||
from ./actors import Ref, hash
|
from ./actors import Ref, hash
|
||||||
from ./protocols/sturdy import Oid
|
from ./protocols/sturdy import Oid
|
||||||
|
|
Loading…
Reference in New Issue