riverqueue / river

Fast and reliable background jobs in Go
https://riverqueue.com
Mozilla Public License 2.0
3.59k stars 94 forks source link

[Feature Request] Multiple errors handling #631

Closed odyfey closed 1 month ago

odyfey commented 1 month ago

When using the errros.Join to return a result from a Work function, all errors are recorded as a single string in the database, which can be inconvenient when viewing a large number of errors in RiverUI. Below is an example code:

func (e *Example) Work(_ context.Context, job *river.Job[ExampleArgs]) error {
    var result []error

       ...

    return errors.Join(result...)
}

The reason for this behaviour may be use of ErrorStr method instead of errors.Unwrap when recording an error in the database.

How do you feel about supporting the recording of a slice of errors in the database and displaying them in RiverUI as a list separated by newlines?