Skip to content

Commit

Permalink
chore: misc code improvements (#1439)
Browse files Browse the repository at this point in the history
  • Loading branch information
ymc9 authored May 12, 2024
1 parent 6852958 commit a49b7b3
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions packages/runtime/src/enhancements/policy/policy-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -570,17 +570,13 @@ export class PolicyUtil extends QueryUtils {
*/
getCheckerConstraint(model: string, operation: PolicyCrudKind): ReturnType<CheckerFunc> | 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
Expand Down

0 comments on commit a49b7b3

Please sign in to comment.