Skip to content

Commit e1bb1bd

Browse files
authored
Merge pull request #128 from cloudstruct/feature/protocol-error-message-name
feat: include message/state name in protocol error message
2 parents f7afb60 + bd90ef7 commit e1bb1bd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

protocol/protocol.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"github.com/cloudstruct/go-ouroboros-network/utils"
88
"github.com/fxamacker/cbor/v2"
99
"io"
10+
"reflect"
1011
"sync"
1112
)
1213

@@ -309,7 +310,7 @@ func (p *Protocol) getNewState(msg Message) (State, error) {
309310
}
310311
}
311312
if !matchFound {
312-
return newState, fmt.Errorf("message not allowed in current protocol state")
313+
return newState, fmt.Errorf("message %s not allowed in current protocol state %s", reflect.TypeOf(msg).Name(), p.state)
313314
}
314315
return newState, nil
315316
}

0 commit comments

Comments
 (0)