Socket
Book a DemoInstallSign in
Socket

unify-mercurius

Package Overview
Dependencies
Maintainers
1
Versions
703
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unify-mercurius

[![Test Coverage](https://api.codeclimate.com/v1/badges/d28d1f8e89ae26ed6055/test_coverage)](https://codeclimate.com/github/qlaffont/unify-mercurius/test_coverage) [![Maintainability](https://api.codeclimate.com/v1/badges/d28d1f8e89ae26ed6055/maintainabil

1.3.452
latest
Source
npmnpm
Version published
Weekly downloads
88
-58.49%
Maintainers
1
Weekly downloads
 
Created
Source

Test Coverage Maintainability npm npm Snyk Vulnerabilities for npm package NPM

Unify Mercurius

A Mercurius plugin wrapping unify-errors to handle REST errors. Old Owner: @flexper

Install

npm i unify-mercurius
# Or
yarn add unify-mercurius
# Or
pnpm add unify-mercurius

Use

'use strict'

const Fastify = require('fastify')
const mercurius = require('mercurius')
const { unifyMercuriusErrorFormatter } = require('unify-mercurius')

const app = Fastify()

const schema = `
  type Query {
    add(x: Int, y: Int): Int
  }
`

const resolvers = {
  Query: {
    add: async (_, { x, y }) => x + y
  }
}

app.register(mercurius, {
  schema,
  resolvers,
  errorFormatter: unifyMercuriusErrorFormatter()
})

app.get('/', async function (req, reply) {
  const query = '{ add(x: 2, y: 2) }'
  return reply.graphql(query)
})

app.listen(3000)

Plugin options

namedefaultdescription
disableDetailsfalseIf true will remove the originalError key from the error response
disableLogfalseDisable logging on error

Tests

To execute jest tests (all errors, type integrity test)

pnpm test

Maintain

This package use TSdx. Please check documentation to update this package.

FAQs

Package last updated on 15 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.