Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add error type used by device service data transformation #533

Merged
merged 1 commit into from
Mar 5, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions errors/types.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (C) 2020 IOTech Ltd
// Copyright (C) 2020-2021 IOTech Ltd
//
// SPDX-License-Identifier: Apache-2.0

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down