errors.gno
0.75 Kb · 19 lines
1package core
2
3import (
4 "errors"
5 "strings"
6)
7
8// ErrSpoofedRealm guards non-crossing (_ int, rlm realm, ...) entrypoints: the
9// passed rlm must be the current crossing frame, not a forged or stale token.
10const errSpoofedRealm = "rlm does not match the current crossing frame"
11
12// makeError builds a fresh error from one or more message parts joined by ", ".
13// Errors are constructed at the call site (never shared package-level values) so
14// the resulting object is owned by this (impl) realm rather than the realm that
15// declared a shared sentinel. The base message constant comes first and any
16// value-carrying detail after, e.g. makeError(core.ErrChannelNotFound, id.String()).
17func makeError(msgs ...string) error {
18 return errors.New(strings.Join(msgs, ", "))
19}