From 8208d98c361384496aadfd9261937573c6dc8bf0 Mon Sep 17 00:00:00 2001 From: ymc9 <104139426+ymc9@users.noreply.github.com> Date: Sun, 12 May 2024 14:34:18 +0800 Subject: [PATCH] chore: misc code improvements --- packages/runtime/src/enhancements/policy/policy-utils.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/runtime/src/enhancements/policy/policy-utils.ts b/packages/runtime/src/enhancements/policy/policy-utils.ts index f485a3a17..b288063c0 100644 --- a/packages/runtime/src/enhancements/policy/policy-utils.ts +++ b/packages/runtime/src/enhancements/policy/policy-utils.ts @@ -570,17 +570,13 @@ export class PolicyUtil extends QueryUtils { */ getCheckerConstraint(model: string, operation: PolicyCrudKind): ReturnType | boolean { const checker = this.getModelChecker(model); - if (!checker) { - throw this.unknownError(`unable to load policy guard for ${model}`); - } - const provider = checker[operation]; if (typeof provider === 'boolean') { return provider; } if (typeof provider !== 'function') { - throw this.unknownError(`unable to load ${operation} checker for ${model}`); + throw this.unknownError(`invalid ${operation} checker function for ${model}`); } // call checker function