Better error message for pattern handler mismatches

This commit is contained in:
Emery Hemingway 2022-10-17 00:26:12 -05:00
parent 299aceeb6b
commit c2b1a5dbb5
3 changed files with 4 additions and 3 deletions

View File

@ -223,6 +223,7 @@ macro during*(turn: var Turn; ds: Ref; pattern: Pattern; publishBody: untyped) =
callbackProc = wrapDuringHandler(publishBody, nil)
callbackSym = callbackProc[0]
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`
discard observe(`turn`, `ds`, `pattern`, during(`callbackSym`))

View File

@ -1,7 +1,7 @@
# SPDX-FileCopyrightText: ☭ 2022 Emery Hemingway
# SPDX-License-Identifier: Unlicense
import std/[hashes, options, tables]
import std/[hashes, tables]
from ./actors import Ref, hash
from ./protocols/sturdy import Oid

View File

@ -1,6 +1,6 @@
# Package
version = "20221016"
version = "20221017"
author = "Emery Hemingway"
description = "Syndicated actors for conversational concurrency"
license = "Unlicense"