Commit e78b7497 authored by Orne Brocaar's avatar Orne Brocaar
Browse files

Do not lookup from errToCode map when error is of type slice.

Closes #631.
parent 651b5725
package helpers
import (
"reflect"
"github.com/pkg/errors"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
......@@ -45,6 +47,13 @@ func ErrToRPCError(err error) error {
return cause
}
// Some error values (error returned by Otto) can not be hashed:
// https://github.com/brocaar/chirpstack-application-server/issues/631
k := reflect.TypeOf(cause).Kind()
if k == reflect.Slice {
return grpc.Errorf(codes.Unknown, cause.Error())
}
code, ok := errToCode[cause]
if !ok {
code = codes.Unknown
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment