Fix null pointer exception

This commit is contained in:
Александр Федорюк 2022-11-23 09:48:42 +03:00
parent 5fe5aed0ab
commit d125ab3431

View File

@ -75,9 +75,13 @@ func (fDesc *funcDesc) worker() {
if res.err != nil {
if pkg.Metadata.QueueCallback != "" {
pkg.ErrNo = 500
pkg.Error = err.Error()
if err != nil {
pkg.Error = err.Error()
} else {
pkg.Error = ""
}
pkg.Metadata.CallResponseID = uuid.NewV4().String()
fDesc.conn.Publish(pkg.Metadata.QueueCallback, []byte(err.Error()))
fDesc.conn.Publish(pkg.Metadata.QueueCallback, []byte(pkg.Error))
}
continue
}
@ -95,15 +99,16 @@ func (fDesc *funcDesc) worker() {
}
continue
case <-time.After(fDesc.timeout):
if err != nil {
if pkg.Metadata.QueueCallback != "" {
pkg.ErrNo = 408
pkg.Error = err.Error()
pkg.Metadata.CallResponseID = uuid.NewV4().String()
fDesc.conn.Publish(pkg.Metadata.QueueCallback, []byte("function call timeout"))
}
continue
//if err != nil {
if pkg.Metadata.QueueCallback != "" {
pkg.ErrNo = 408
//pkg.Error = err.Error()
pkg.Error = "function call timeout"
pkg.Metadata.CallResponseID = uuid.NewV4().String()
fDesc.conn.Publish(pkg.Metadata.QueueCallback, []byte("function call timeout"))
}
continue
//}
}
}
}