Is it possible to convert a std.builtin.TypeInfo.Error back to its error value?

Viewed 79

The struct std.builtin.TypeInfo.Error only contains a name field. And since no @nameToError function exists, I don't see a way to convert this to it's error value.

In version 0.6 of zig that struct has a value field, which holds the number to instantiate the error via @intToError. But that no longer exists.

Am I overseeing something?

1 Answers

I've got the answer via the zig issue tracker.

@field(MyErrorSet, "errorName")

can be used to get the error value.

Related