errs: fixed error message not giving proper spacing
This commit is contained in:
parent
c26d9fa0b0
commit
1c1c0d03d9
|
@ -27,6 +27,9 @@ func (api *API) DevicesUpdate(ctx context.Context, slug string, update *models.D
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := device.Reload(ctx, api.db); err != nil {
|
if err := device.Reload(ctx, api.db); err != nil {
|
||||||
|
if err.Error() == "sql: no rows in result set" {
|
||||||
|
return device, errs.Wrapw(err, "device not found", "slug", slug).Code(404)
|
||||||
|
}
|
||||||
return device, errs.Wrapw(err, "failed to reload device", "slug", slug)
|
return device, errs.Wrapw(err, "failed to reload device", "slug", slug)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,6 +74,9 @@ func (er *Err) Error() string {
|
||||||
s := strings.Builder{}
|
s := strings.Builder{}
|
||||||
if er.message != "" {
|
if er.message != "" {
|
||||||
s.WriteString(er.message)
|
s.WriteString(er.message)
|
||||||
|
if er.origin != nil {
|
||||||
|
s.WriteString(": ")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for unwrap := errors.Unwrap(er); unwrap != nil; {
|
for unwrap := errors.Unwrap(er); unwrap != nil; {
|
||||||
if e, ok := unwrap.(Error); ok && e.GetMessage() != "" {
|
if e, ok := unwrap.(Error); ok && e.GetMessage() != "" {
|
||||||
|
|
Loading…
Reference in a new issue