From bc9875b4b00f22ed2575ea7602ca83d3eeef88c8 Mon Sep 17 00:00:00 2001 From: tidwall Date: Thu, 25 Aug 2022 16:56:07 -0700 Subject: [PATCH] Add SimpleError --- resp.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/resp.go b/resp.go index 67196c9..861cdae 100644 --- a/resp.go +++ b/resp.go @@ -544,6 +544,10 @@ type SimpleString string // from an *Any call. type SimpleInt int +// SimpleError is for representing an error without adding the "ERR" prefix +// from an *Any call. +type SimpleError error + // Marshaler is the interface implemented by types that // can marshal themselves into a Redis response type from an *Any call. // The return value is not check for validity. @@ -570,6 +574,8 @@ func AppendAny(b []byte, v interface{}) []byte { b = AppendString(b, string(v)) case SimpleInt: b = AppendInt(b, int64(v)) + case SimpleError: + b = AppendError(b, v.Error()) case nil: b = AppendNull(b) case error: