On Fri, Dec 27, 2019 at 11:33 AM George Dunlap <george.dun...@citrix.com> wrote:
>
> Commit 871e51d2d4 changed the sign on the xenlight error types (making
> the values negative, same as the C-generated constants), but failed to
> flip the sign in the Error() string function.  The result is that
> ErrorNonspecific.String() prints "libxl error: 1" rather than the
> human-readable error message.

Since we're here, what would you think about re-defining libxlErrors
as a map[Error]string? That way, Error() can just be:

func (e Error) Error() string {
        if s, ok := libxlErrors[e]; ok {
                return s
        }

        return fmt.Sprintf("libxl error: %d", e)
}

I think it's less error-prone and easier to read. Thoughts?

-NR

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to