Add context for all exceptions

Signed-off-by: Asai Neko <sugar@sne.moe>
This commit is contained in:
2026-01-21 19:37:20 +08:00
parent 154c929859
commit 986f63c0af
16 changed files with 91 additions and 87 deletions

View File

@@ -1,6 +1,7 @@
package exception
import (
"context"
"fmt"
)
@@ -50,7 +51,7 @@ func (self *Builder) SetError(e error) *Builder {
return self
}
func (self *Builder) Build() string {
func (self *Builder) Build(ctx context.Context) string {
errorCode := fmt.Sprintf("%s%s%s%s%s",
self.Status,
self.Service,
@@ -59,7 +60,7 @@ func (self *Builder) Build() string {
self.Original,
)
if self.Error != nil {
ErrorHandler(self.Status, errorCode, self.Error)
ErrorHandler(ctx, self.Status, errorCode, self.Error)
}
return errorCode
}