File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -369,6 +369,46 @@ $specification = [
369369
370370The exponent filter spec will call the PHP function ` pow() ` with the value provided and the result of the filtered ` base `
371371
372+ ## throwOnError
373+
374+ #### Summary
375+
376+ If true the Filterer will throw any exception caught when filtering a value instead of returning the error in the filter response.
377+
378+ #### Types
379+
380+ * boolean
381+
382+ #### Default
383+
384+ The default value for this option is ` false `
385+
386+ #### Constant
387+
388+ ``` php
389+ TraderInteractive\FilterOptions::THROW_ON_ERROR
390+ ```
391+
392+ #### Example
393+
394+ ``` php
395+ $idFilter = function ($id) : int {
396+ if (!is_int($id)) {
397+ throw new NotFoundException("id '{$id}' was not found");
398+ }
399+
400+ return $id;
401+ };
402+ $specification = [
403+ 'id' => [
404+ \TraderInteractive\FilterOptions::THROW_ON_ERROR => true,
405+ [$idFilter],
406+ ],
407+ ];
408+ ```
409+
410+ If the ` id ` value given in the input is not an integer the Filterer::execute() will throw the ` NotFoundException `
411+
372412### Included Filters
373413Of course, any function can potentially be used as a filter, but we include some useful filters with aliases for common circumstances.
374414
You can’t perform that action at this time.
0 commit comments