Skip to content

Commit

Permalink
throw new Meteor.Error
Browse files Browse the repository at this point in the history
  • Loading branch information
ggazzo committed May 11, 2022
1 parent e938504 commit f9f4a0a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion apps/meteor/app/api/server/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,11 @@ export class APIClass extends Restivus {
api.enforceRateLimit(objectForRateLimitMatch, this.request, this.response, this.userId);

if (_options.validateParams && !_options.validateParams(this.request.method === 'GET' ? this.queryParams : this.bodyParams)) {
return API.v1.failure('invalid-params', _options.validateParams.errors?.map((error) => error.message).join('\n '));
throw new Meteor.Error(
'invalid-params',
'invalid-params',
_options.validateParams.errors?.map((error) => error.message).join('\n '),
);
}
if (shouldVerifyPermissions && (!this.userId || !hasAllPermission(this.userId, _options.permissionsRequired))) {
throw new Meteor.Error('error-unauthorized', 'User does not have the permissions required for this action', {
Expand Down

0 comments on commit f9f4a0a

Please sign in to comment.