Skip to content
This repository was archived by the owner on Feb 17, 2026. It is now read-only.

About

SimpleRest error middleware for converting thrown Meteor.Errors to JSON (according to JSend specification) and sending the response.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

liberation:rest-jsend-error-handler

SimpleRest error middleware for converting thrown Meteor.Errors to JSON (according to JSend specification) and sending the response. Based on simple:rest-json-error-handler.

Usage

Handle errors from all routes:

JsonRoutes.ErrorMiddleware.use(RestMiddleware.handleErrorAsJsend);

Handle errors from one route:

JsonRoutes.ErrorMiddleware.use(
  '/handle-error',
  RestMiddleware.handleErrorAsJsend
);

Example

Response looks like:

{
  "status": "error",
  "message": "Validation failed",
  "code": 400,
  "data": {
    "error": "validation-error",
    "reason": "Validation failed",
    "details": [
      {
        "name": "userId",
        "type": "invalid-value"
      }
    ]
  }
}

About

SimpleRest error middleware for converting thrown Meteor.Errors to JSON (according to JSend specification) and sending the response.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages