From 076855ea3ca39f212195ed56ae87954c0b7b2783 Mon Sep 17 00:00:00 2001 From: Chris Hung Date: Fri, 5 Mar 2021 12:13:22 +0800 Subject: [PATCH] feat: add error type used by device service data transformation Signed-off-by: Chris Hung --- errors/types.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/errors/types.go b/errors/types.go index 09243f0c..5c806ffb 100644 --- a/errors/types.go +++ b/errors/types.go @@ -1,5 +1,5 @@ // -// Copyright (C) 2020 IOTech Ltd +// Copyright (C) 2020-2021 IOTech Ltd // // SPDX-License-Identifier: Apache-2.0 @@ -34,6 +34,8 @@ const ( KindRangeNotSatisfiable ErrKind = "RangeNotSatisfiable" KindClientError ErrKind = "ClientError" KindIOError ErrKind = "IOError" + KindOverflowError ErrKind = "OverflowError" + KindNaNError ErrKind = "NaNError" ) // Error codes are not defined in HTTP status codes @@ -186,7 +188,7 @@ func getCallerInformation() string { // codeMapping determines the correct HTTP response code for the given error kind. func codeMapping(kind ErrKind) int { switch kind { - case KindUnknown, KindDatabaseError, KindServerError: + case KindUnknown, KindDatabaseError, KindServerError, KindOverflowError, KindNaNError: return http.StatusInternalServerError case KindCommunicationError: return http.StatusBadGateway