Capture Sentry Error

I use beforeSend in Sentry.init() to filter some error,but sentry server receive a SentryError instand of CustomError like beforeSend returned null , will not send event.. Is there a way to filter error and not send issue to backend?

Sentry.init({
    beforeSend: function (event, hint) {
        if(...) {
            return null; 
       }
       return event;
   }
})

SDK version: 5.30.0
Server Version: 9.1.2

@linzebin which SDK (language/framework etc) is it?

@marandaneto JavaScript.