Nodejs unexpected breadcrumbs on exceptions

Hello,

I can’t understand why the following code:


const main = async () => {

    Sentry.addBreadcrumb({
        message: 'first'
    })
    Sentry.captureMessage('first')

    Sentry.addBreadcrumb({
        message: 'second'
    })
    Sentry.captureMessage('second')

    Sentry.addBreadcrumb({
        message: 'third'
    })
    Sentry.captureMessage('third')

}

main()

correctly shows the past added breadcrumbs on each captured messages but doing so with captureException:

const main = async () => {

    Sentry.addBreadcrumb({
        message: 'first'
    })
    Sentry.captureException('first')

    Sentry.addBreadcrumb({
        message: 'second'
    })
    Sentry.captureException('second')

    Sentry.addBreadcrumb({
        message: 'third'
    })
    Sentry.captureException('third')

}

main()

does not. It actually shows all 3 breadcrumbs on all the captured exceptions. I’d rather expect to see only the previous ones.

sdk name: sentry.javascript.node
version: 5.28.0