From 83d089ec9de9ed119869dc69fbb380b50e3a7398 Mon Sep 17 00:00:00 2001 From: Elim Tsiagbey Date: Fri, 14 Jul 2023 10:21:12 -0400 Subject: [PATCH] chore: Change summary errors field type (#3447) chore: Change summary errors field type decoding summary `Errors` field currently fails with type `error`. Using a string type to handle `Errors` field --- internal/bsr/types.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/internal/bsr/types.go b/internal/bsr/types.go index 536872327..4cada819d 100644 --- a/internal/bsr/types.go +++ b/internal/bsr/types.go @@ -5,6 +5,7 @@ package bsr import ( "context" + "errors" "time" ) @@ -48,7 +49,7 @@ type BaseSessionSummary struct { ConnectionCount uint64 StartTime time.Time EndTime time.Time - Errors error + Errors string } // SessionSummary contains statistics for a session container @@ -88,12 +89,12 @@ func (b *BaseSessionSummary) GetConnectionCount() uint64 { // GetErrors returns errors. func (b *BaseSessionSummary) GetErrors() error { - return b.Errors + return errors.New(b.Errors) } // SetErrors sets errors. func (b *BaseSessionSummary) SetErrors(e error) { - b.Errors = e + b.Errors = e.Error() } // BaseChannelSummary encapsulates data for a channel, including its id, channel type, @@ -169,7 +170,7 @@ type BaseConnectionSummary struct { EndTime time.Time BytesUp uint64 BytesDown uint64 - Errors error + Errors string } // ConnectionSummary contains statistics for a connection container @@ -223,10 +224,10 @@ func (b *BaseConnectionSummary) GetBytesDown() uint64 { // GetErrors returns errors. func (b *BaseConnectionSummary) GetErrors() error { - return b.Errors + return errors.New(b.Errors) } // SetErrors sets errors. func (b *BaseConnectionSummary) SetErrors(e error) { - b.Errors = e + b.Errors = e.Error() }