Skip to content

Commit

Permalink
Merge pull request #149 from janpfeifer/stacktrace
Browse files Browse the repository at this point in the history
Added stack traces to protocol error messages.
  • Loading branch information
janpfeifer authored Jan 19, 2025
2 parents 2c8d5b3 + 0b2a8a2 commit 7169983
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* Improved `autostart` logic: it now requires being mounted as "readonly" under `/root/autostart`.
* Added `%version`, and environment variables `GONB_VERSION`, `GONB_GIT_COMMIT`.
* Added `%help` info on missing environment variables.
* Added stack traces to protocol parsing errors.

## v0.10.6, 2024/10/16, Improved Docker, added `%capture`

Expand Down
12 changes: 6 additions & 6 deletions internal/kernel/kernel.go
Original file line number Diff line number Diff line change
Expand Up @@ -520,11 +520,11 @@ func (k *Kernel) FromWireMsg(zmqMsg zmq4.Msg) Message {
signature := make([]byte, hex.DecodedLen(len(parts[i+1])))
_, err := hex.Decode(signature, parts[i+1])
if err != nil {
m.err = errors.WithMessagef(&InvalidSignatureError{}, "while decoding received message")
m.err = errors.Wrapf(&InvalidSignatureError{}, "while hex-decoding received message")
return m
}
if !hmac.Equal(mac.Sum(nil), signature) {
m.err = errors.WithMessagef(&InvalidSignatureError{}, "invalid signature of received message, doesn't match secret key used during initialization")
m.err = errors.Wrapf(&InvalidSignatureError{}, "invalid check sum of received message, doesn't match secret key used during initialization")
return m
}
}
Expand All @@ -533,22 +533,22 @@ func (k *Kernel) FromWireMsg(zmqMsg zmq4.Msg) Message {
var err error
err = json.Unmarshal(parts[i+2], &m.Composed.Header)
if err != nil {
m.err = errors.WithMessagef(err, "while decoding ComposedMsg.Header")
m.err = errors.Wrapf(err, "while decoding ComposedMsg.Header")
return m
}
err = json.Unmarshal(parts[i+3], &m.Composed.ParentHeader)
if err != nil {
m.err = errors.WithMessagef(err, "while decoding ComposedMsg.ParentHeader")
m.err = errors.Wrapf(err, "while decoding ComposedMsg.ParentHeader")
return m
}
err = json.Unmarshal(parts[i+4], &m.Composed.Metadata)
if err != nil {
m.err = errors.WithMessagef(err, "while decoding ComposedMsg.Metadata")
m.err = errors.Wrapf(err, "while decoding ComposedMsg.Metadata")
return m
}
err = json.Unmarshal(parts[i+5], &m.Composed.Content)
if err != nil {
m.err = errors.WithMessagef(err, "while decoding ComposedMsg.Content")
m.err = errors.Wrapf(err, "while decoding ComposedMsg.Content")
return m
}
return m
Expand Down

0 comments on commit 7169983

Please sign in to comment.