Skip to content

Commit

Permalink
add error message for the issue herrissa was having
Browse files Browse the repository at this point in the history
  • Loading branch information
kach committed Nov 21, 2024
1 parent 1998576 commit ca1db5e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions memo/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,16 @@ def eval_expr(e: Expr, ctxt: Context) -> Value:
loc=arg.loc,
)

for _, source_name, source_id in ids:
if (source_name, source_id) not in ctxt.frame.choices:
raise MemoError(
"Unknown choice referenced in a memo call",
hint=f"{ctxt.frame.name} does not yet model {source_name}'s choice of {source_id}.",
user=True,
ctxt=ctxt,
loc=e.loc
)

with ctxt.hoist():
res = ctxt.sym(f"result_array_{name}")
doms = [ctxt.frame.choices[source_name, source_id].domain for _, source_name, source_id in ids]
Expand Down

0 comments on commit ca1db5e

Please sign in to comment.