From dac41678754399dd12f7e51bc4ead0f5885af7e5 Mon Sep 17 00:00:00 2001 From: Kelvin Wang Date: Mon, 25 Mar 2019 12:03:39 -0400 Subject: [PATCH] fix(http): fix template not found error --- document.go | 3 +++ kv/document.go | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/document.go b/document.go index be3c34ebd6..4190505d28 100644 --- a/document.go +++ b/document.go @@ -4,6 +4,9 @@ import ( "context" ) +// ErrDocumentNotFound is the error msg for a missing document. +const ErrDocumentNotFound = "document not found" + // DocumentService is used to create/find instances of document stores. type DocumentService interface { CreateDocumentStore(ctx context.Context, name string) (DocumentStore, error) diff --git a/kv/document.go b/kv/document.go index b481e300a1..bb76c5d776 100644 --- a/kv/document.go +++ b/kv/document.go @@ -581,6 +581,13 @@ func (s *DocumentStore) FindDocuments(ctx context.Context, opts ...influxdb.Docu return nil }) + if IsNotFound(err) { + return nil, &influxdb.Error{ + Code: influxdb.ENotFound, + Msg: influxdb.ErrDocumentNotFound, + } + } + if err != nil { return nil, err }