From 25c2efd132596de60d1788728c9fa7026014e892 Mon Sep 17 00:00:00 2001 From: Ollie Pauffley Date: Thu, 17 Sep 2020 10:07:16 +0100 Subject: [PATCH] fix: add missing error generator --- lusherr/errors.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lusherr/errors.go b/lusherr/errors.go index 1c87f47..f26f13c 100644 --- a/lusherr/errors.go +++ b/lusherr/errors.go @@ -248,6 +248,14 @@ func (e NotAllowedError) Pin(frame runtime.Frame) error { return e } +// NewBadRequestError builds an error for when a client send a bad request. +// e.g. a client sends a request that is missing a required field. +func NewBadRequestError(inner error) error { + return BadRequestError{ + frame: frame(1), + inner: inner, + } +} // BadRequestError indicates that the server cannot or will not // process the request due to something that is perceived to be a client error. type BadRequestError struct {