Skip to content

qoq-ts/qoq-json-error

Repository files navigation

qoq-json-error

JSON error support for qoq based on koa-json-error

Installation

yarn add qoq-json-error

Usage

import { WebSlotManager } from 'qoq';
import { JsonError } from 'qoq-json-error';

export webSlots = WebSlotManager
  .use(new JsonError((err) => {
    return {
        // Copy some attributes from
        // the original error
        status: err.status,
        message: err.message,

        // ...or add some custom ones
        success: false,
        reason: 'Unexpected'
    }
  }));

Options

@see koa-json-error

About

Error handler for pure-JSON apps

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published