1
0
mirror of https://github.com/mainflux/mainflux.git synced 2025-04-28 13:48:49 +08:00
Mainflux.mainflux/sdk/go/sdk_test.go
Manuel Imperiale f982b8ccc6
NOISSUE - Use HTTP Status in SDK error messages (#1119)
* NOISSUE - Use HTTP Status in SDK error messages

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Add helper function to create errors

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fyx Typo

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Revert ErrNotFound

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Rm InvalidArgs and NotFoundound errors from SDK

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
2020-04-16 14:45:28 +02:00

17 lines
331 B
Go

// Copyright (c) Mainflux
// SPDX-License-Identifier: Apache-2.0
package sdk_test
import (
"fmt"
"net/http"
"github.com/mainflux/mainflux/errors"
)
func createError(e error, statusCode int) error {
httpStatus := fmt.Sprintf("%d %s", statusCode, http.StatusText(statusCode))
return errors.Wrap(e, errors.New(httpStatus))
}