如果找不到值,有没有办法抛出错误?
JSON:
{
"qty": 2
}
数据格式:
"order=" & order & ",qty=" & qty
如果order
不在 JSON 中,将使用空值。如果值不存在,我想抛出一个错误,例如:
"order=" & $not_empty(order) & ",qty=" & qty
谢谢!
如果找不到值,有没有办法抛出错误?
JSON:
{
"qty": 2
}
数据格式:
"order=" & order & ",qty=" & qty
如果order
不在 JSON 中,将使用空值。如果值不存在,我想抛出一个错误,例如:
"order=" & $not_empty(order) & ",qty=" & qty
谢谢!
有一个$error函数可以与该$exists
函数一起使用来创建您自己的实现 if $not_empty
。例如:
(
$not_empty := function($val) { $exists($val) ? $val : $error("Missing!")};
"order=" & $not_empty(order) & ",qty=" & qty
)