Skip to content

Commit 8a3c0e6

Browse files
committed
aider/observer: improve logging
Signed-off-by: Jakub Sztandera <[email protected]>
1 parent 73dd2a3 commit 8a3c0e6

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

observer/model.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,11 @@ func supplementalDataFromGpbft(sd gpbft.SupplementalData) SupplementalData {
151151
func (m Message) ToPartialMessage() (*gpbft.PartialGMessage, error) {
152152
payload, err := m.Vote.ToGpbftPayload()
153153
if err != nil {
154-
return nil, err
154+
return nil, fmt.Errorf("could not convert vote to gpbft payload: %w", err)
155155
}
156156
gj, err := m.Justification.ToGpbftJustification()
157157
if err != nil {
158-
return nil, err
158+
return nil, fmt.Errorf("could not convert justification to gpbft justification: %w", err)
159159
}
160160

161161
return &gpbft.PartialGMessage{
@@ -173,16 +173,16 @@ func (m Message) ToPartialMessage() (*gpbft.PartialGMessage, error) {
173173
func (p Payload) ToGpbftPayload() (gpbft.Payload, error) {
174174
phase, err := phaseFromString(p.Phase)
175175
if err != nil {
176-
return gpbft.Payload{}, err
176+
return gpbft.Payload{}, fmt.Errorf("could not convert phase: %w", err)
177177
}
178178
sd, err := p.SupplementalData.ToGpbftSupplementalData()
179179
if err != nil {
180-
return gpbft.Payload{}, err
180+
return gpbft.Payload{}, fmt.Errorf("could not convert supplemental data: %w", err)
181181
}
182182

183183
gv, err := ToGpbftChain(p.Value...)
184184
if err != nil {
185-
return gpbft.Payload{}, err
185+
return gpbft.Payload{}, fmt.Errorf("could not convert value: %w", err)
186186
}
187187

188188
return gpbft.Payload{
@@ -246,14 +246,14 @@ func (j *Justification) ToGpbftJustification() (*gpbft.Justification, error) {
246246
gsigners, _ := bitfield.NewFromIter(ri)
247247
payload, err := j.Vote.ToGpbftPayload()
248248
if err != nil {
249-
return nil, err
249+
return nil, fmt.Errorf("could not convert vote to gpbft payload: %w", err)
250250
}
251251

252252
// Embedded struct as json, hence the decode.
253253
s := string(j.Signature)
254254
decoded, err := base64.StdEncoding.DecodeString(s)
255255
if err != nil {
256-
return nil, err
256+
return nil, fmt.Errorf("could not decode signature: %w", err)
257257
}
258258

259259
return &gpbft.Justification{

0 commit comments

Comments
 (0)