trufflehog/pkg/common/export_error.go
Miccah 9642d4c8fd
Add flag to write job reports to disk (#2298)
* Add flag to write job reports to disk

* Fix nil pointer / non-nil interface bug

* Synchronize job report writer goroutine

* Log when the report has been written
2024-02-09 12:30:28 -08:00

16 lines
471 B
Go

package common
// ExportError is an implementation of error that can be JSON marshalled. It
// must be a public exported type for this reason.
type ExportError string
func (e ExportError) Error() string { return string(e) }
// ExportErrors converts a list of errors into []ExportError.
func ExportErrors(errs ...error) []error {
output := make([]error, 0, len(errs))
for _, err := range errs {
output = append(output, ExportError(err.Error()))
}
return output
}