E0016: custom_checker_failed
E0016 custom_checker_failed — a cell checker rule failed.
A compile-time error of soma check, the checker of the Soma programming language (soma explain E0016).
The rule
A cell checker holds project rules that soma check runs against every other cell; a require <predicate> else Tag that is false for a cell is reported with the checker name, the cell and the tag. Here has_auth holds only for a cell whose face declares a given auth (or given token). Fix the cell so the predicate holds — or change the rule if it is wrong.
A program that triggers it
wrong.cell
cell checker every_api_authenticated {
face {
promise "every cell with signals takes an auth token"
}
rules {
check {
require has_auth else MissingAuth
}
}
}
cell OrdersApi {
face {
signal cancel(order_id: String) -> String
}
on cancel(order_id: String) {
return "cancelled {order_id}"
}
}What soma check prints:
$ soma check wrong.cell
error: checker 'every_api_authenticated' failed: cell 'OrdersApi' failed check 'MissingAuth' (every cell with signals takes an auth token)
--> wrong.cell:7:21
|
7 | require has_auth else MissingAuth
| ^
= code: E0016
✗ 1 error(s), 0 warning(s).The fix field of soma check --json: checker 'every_api_authenticated' failed: cell 'OrdersApi' failed check 'MissingAuth' (every cell with signals takes an auth token)
The fix
1 line is added after line 13.
wrong.cell → right.cell
--- wrong.cell
+++ right.cell
@@ -12,4 +12,5 @@
cell OrdersApi {
face {
+ given auth: String
signal cancel(order_id: String) -> String
}With the fix, soma check accepts the program:
$ soma check right.cell
✓ All checks passed.