content/flux/v0/stdlib/internal/testing/shoulderrorwithcode.md
testing.shouldErrorWithCode() calls a function that catches any error and checks that the error matches the expected value.
(code: uint, fn: () => A, want: regexp) => stream[{match: bool, code: uint, _diff: string}]
{{% caption %}} For more information, see Function type signatures. {{% /caption %}}
({{< req >}}) Function to call.
({{< req >}}) Regular expression to match the expected error.
({{< req >}}) Which flux error code to expect
import "testing"
testing.shouldErrorWithCode(fn: () => die(msg: "error message"), want: /error message/, code: 3)