Skip to content

Commit a8501a5

Browse files
committed
♻️ refactor: updated codebase #2
1 parent 967b843 commit a8501a5

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

internal/middlewares/errors_middleware.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ func (m *MiddlewareManager) notification(c *gin.Context, err any, status int) {
3939
return
4040
}
4141
var builder strings.Builder
42-
icon, _ := blueprint.TypeIcons[blueprint.TypeError]
42+
icon := blueprint.TypeIcons[blueprint.TypeError]
4343
builder.WriteString(fmt.Sprintf("%v %s\n", icon, "Core Application Recovery"))
44-
builder.WriteString(fmt.Sprintf("Tz: %s\n", time.Now().Format(timex.DateTimeFormYearMonthDayHourMinuteSecond)))
44+
builder.WriteString(fmt.Sprintf("Tz: %s\n", time.Now().Format(timex.TimeFormat20060102150405)))
4545
builder.WriteString(fmt.Sprintf("URL: `%s`\n", c.Request.RequestURI))
4646
builder.WriteString(fmt.Sprintf("Status Code: %d\n", status))
4747
builder.WriteString(fmt.Sprintf("Message: %s\n", http.StatusText(status)))

internal/middlewares/interceptor_middleware.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ func (m *MiddlewareManager) console(c *gin.Context, response *responseWriterWrap
7272
}
7373

7474
func (m *MiddlewareManager) notify(c *gin.Context, response *responseWriterWrapper, timestamp string, raw []byte, err error) {
75-
conf, err := m.conf.FindTelegramSeeker(constant.TelegramKeyTenant1)
76-
if err != nil {
77-
logger.Errorf("Telegram Bot Notify", err)
75+
conf, _err := m.conf.FindTelegramSeeker(constant.TelegramKeyTenant1)
76+
if _err != nil {
77+
logger.Errorf("Telegram Bot Notify", _err)
7878
return
7979
}
8080
if !conf.Config.IsEnabled {
@@ -85,9 +85,9 @@ func (m *MiddlewareManager) notify(c *gin.Context, response *responseWriterWrapp
8585
url := c.Request.URL.String()
8686
method := c.Request.Method
8787
if entity.IsStatusCodeSuccess(c.Writer.Status()) {
88-
icon, _ = blueprint.TypeIcons[blueprint.TypeSuccess]
88+
icon = blueprint.TypeIcons[blueprint.TypeSuccess]
8989
} else {
90-
icon, _ = blueprint.TypeIcons[blueprint.TypeError]
90+
icon = blueprint.TypeIcons[blueprint.TypeError]
9191
}
9292
builder.WriteString(fmt.Sprintf("%v %s\n", icon, "Request Notify"))
9393
builder.WriteString(fmt.Sprintf("Tz: `%s`\n\n", timestamp))

internal/middlewares/recovery_middleware.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ func (m *MiddlewareManager) defaultHandleRecovery(c *gin.Context, err any) {
7979
response.SetErrors(fmt.Sprint(err))
8080
m.notification(c, err, response.StatusCode)
8181
c.JSON(response.StatusCode, response)
82-
return
8382
}
8483

8584
// stack returns a nicely formatted stack frame, skipping skip frames.

0 commit comments

Comments
 (0)