(func: () => Promise<any>)
| 625 | |
| 626 | // Async version is the default |
| 627 | export const validateWith = async (func: () => Promise<any>) => { |
| 628 | try { |
| 629 | await func() |
| 630 | } catch (e) { |
| 631 | const message = (e as Error).message || (e as string) |
| 632 | throw new ValidationErrors.ServiceValidationError(message) |
| 633 | } |
| 634 | } |
| 635 | |
| 636 | // Wraps `callback` in a transaction to guarantee that `field` is not found in |
| 637 | // the database and that the `callback` is executed before someone else gets a |
no test coverage detected