Switch branches/tags
Clone or download
Failed to load latest commit information.
.circleci Align CI Dec 28, 2017
Sources Updated to Vapor 2 Apr 26, 2017
Tests Updated to Vapor 2 Apr 26, 2017
.codebeatignore Align CI Dec 28, 2017
.codecov.yml Create .codecov.yml Jun 29, 2017
.gitignore Initial commit Jan 9, 2017
.swiftlint.yml Align CI Dec 28, 2017
LICENSE Align CI Dec 28, 2017
Package.swift Remove prereleaseIdentifiers May 29, 2017
README.md Align CI Dec 28, 2017



Swift Version Vapor Version Circle CI codebeat badge codecov Readme Score GitHub license

Vapor errors with more granularity.

πŸ“¦ Installation

Update your Package.swift file.

.Package(url: "https://github.com/nodes-vapor/error-extended.git", majorVersion: 1)

Getting started πŸš€

import ErrorExtended

If you need more granular control on the content that goes into your errors conforming to the AbortError protocol you can use the AbortExtended type instead (which conforms to AbortError). This type will give you access to all of the parameters as well as providing you with some convenient extra parameters.

A couple of examples:

throw AbortExtended.custom(code: 1337)
throw AbortExtended.custom(
  status: .badRequest, 
  code: 1337, 
  message: "Sorry, bad request", 
  report: false
throw AbortExtended.custom(
  status: .badGateway, 
  code: Status.badGateway.statusCode, 
  message: Status.badGateway.reasonPhrase, 
  metadata: Node(["key": "value"]), 
  report: false

Any middleware (e.g. bugsnag) that tries to catch errors conforming to AbortError will then pick this up.

πŸ† Credits

This package is developed and maintained by the Vapor team at Nodes. The package owner for this project is Rasmus.

πŸ“„ License

This package is open-sourced software licensed under the MIT license