From 25b7f81e3bbbef64a9d66bc08cfa43e58ec106ce Mon Sep 17 00:00:00 2001 From: Winni Neessen Date: Fri, 1 Nov 2024 15:57:59 +0100 Subject: [PATCH] Refactor error handling logic and string formatting Replaced constant with named error for readability and maintainability in the error handling condition. Adjusted error message formatting by removing an extra space for consistency. --- senderror.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/senderror.go b/senderror.go index 1943e28..4471208 100644 --- a/senderror.go +++ b/senderror.go @@ -81,7 +81,7 @@ type SendErrReason int // Returns: // - A string representing the error message. func (e *SendError) Error() string { - if e.Reason > 10 { + if e.Reason > ErrAmbiguous { return "unknown reason" } @@ -93,7 +93,7 @@ func (e *SendError) Error() string { errMessage.WriteRune(' ') errMessage.WriteString(e.errlist[i].Error()) if i != len(e.errlist)-1 { - errMessage.WriteString(", ") + errMessage.WriteString(",") } } }