Haw can I send to sentry log only custom handled error?

I am using this approach for handling JS error

    Sentry.init({ dsn: 'https://XXXXXXXXXXXXXXXXXX@sentry.io/XXXXXXX' });
    axios.interceptors.response.use((response) => {
        return response;
    }, error => {
        // handle the response error
        if(error.response.status === 500){
            Sentry.captureException(error)
        }
        return Promise.reject(error);
    });

What setting should I use to log only selected errors not all?