Skip to content

Latest commit

 

History

History
80 lines (56 loc) · 1.19 KB

MIGRATION_GUIDE.md

File metadata and controls

80 lines (56 loc) · 1.19 KB

Migrating from v4 to v5

Filtering events

v4

const fastify = require('fastify');
const sentry = require('@immobiliarelabs/fastify-sentry');

const app = fastify();

app.register(sentry, {
    allowedStatusCodes: [404]
});

v5

const sentry = require('@immobiliarelabs/fastify-sentry');

const app = fastify();

app.register(sentry, {
    shouldHandleError(error, request, reply) {
        if (error.statusCode === 404) {
            return false
        }
        return true
    }
});

Custom error handler

v4

const fastify = require('fastify');
const sentry = require('@immobiliarelabs/fastify-sentry');

const app = fastify();

app.register(sentry, {
    onErrorFactory({ allowedStatusCodes }) {
        ...
    }
});

v5

const fastify = require('fastify');
const sentry = require('@immobiliarelabs/fastify-sentry');

const app = fastify();

app.register(sentry, {
    setErrorHandler: false
});

app.setErrorHandler(function (error, request, reply) {
    ...
})