raven

package
v0.0.0-...-a4dd944 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 3, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package raven contains middleware than depends on github.com/kisielk/raven-go/raven

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildErrorCatcher

func BuildErrorCatcher(sentryDSN string) func(c *web.C, h http.Handler) http.Handler

Middleware that catches panics, and:

  • logs them
  • optionally reports them to sentry - pass in "" if you don't want this
  • sends a 500 response

You can also use ThrowError() to raise an error that this middleware will catch, for example if you want an error to be reported to sentry

func MakeError

func MakeError(statusCode int, format string, params ...interface{}) error

func ThrowError

func ThrowError(statusCode int, format string, params ...interface{})

Types

type HttpError

type HttpError struct {
	StatusCode int
	Message    string
}

An error that encapsulates an HTTP status code and message.

Use ThrowError() to build an HttpError and raise it as a panic

func (HttpError) Error

func (h HttpError) Error() string

func (HttpError) WriteResponse

func (h HttpError) WriteResponse(w http.ResponseWriter)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL