Skip to content

Commit

Permalink
fix: address CodeRabbit nitpicks, consistent output formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
sm3142 committed Nov 14, 2024
1 parent eee2d29 commit 7e4e027
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion error.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ func WriteErr(api API, ctx Context, status int, msg string, errs ...error) error
writeErr := writeResponse(api, ctx, status, "", err)
if writeErr != nil {
// If we can't write the error, log it so we know what happened.
fmt.Fprintf(os.Stderr, "could not write error: %s\n", writeErr)
fmt.Fprintf(os.Stderr, "could not write error: %v\n", writeErr)
}
return writeErr
}
Expand Down
6 changes: 3 additions & 3 deletions sse/sse.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,10 @@ func Register[I any](api huma.API, op huma.Operation, eventTypeMap map[string]an
send := func(msg Message) error {
if deadliner != nil {
if err := deadliner.SetWriteDeadline(time.Now().Add(WriteTimeout)); err != nil {
fmt.Fprintln(os.Stderr, "warning: unable to set write deadline: "+err.Error())
fmt.Fprintf(os.Stderr, "warning: unable to set write deadline: %v\n", err)
}
} else {
fmt.Fprintln(os.Stderr, "warning: unable to set write deadline")
fmt.Fprintln(os.Stderr, "write deadline not supported by underlying writer")
}

// Write optional fields
Expand All @@ -177,7 +177,7 @@ func Register[I any](api huma.API, op huma.Operation, eventTypeMap map[string]an

event, ok := typeToEvent[deref(reflect.TypeOf(msg.Data))]
if !ok {
fmt.Fprintln(os.Stderr, "error: unknown event type", reflect.TypeOf(msg.Data))
fmt.Fprintf(os.Stderr, "error: unknown event type %v\n", reflect.TypeOf(msg.Data))
debug.PrintStack()
}
if event != "" && event != "message" {
Expand Down

0 comments on commit 7e4e027

Please sign in to comment.