diff options
| author | gingerBill <gingerBill@users.noreply.github.com> | 2022-02-15 16:25:28 +0000 |
|---|---|---|
| committer | gingerBill <gingerBill@users.noreply.github.com> | 2022-02-15 16:25:28 +0000 |
| commit | 21864d8d51872b98dbb1ca3dd3d86d2cb0d8a364 (patch) | |
| tree | ac037ce23119452455732eddc4c2059b0562b99e | |
| parent | d45ff0694d193fd15b0153ff1696de2b0a8606c3 (diff) | |
Improve BAD ENUM VALUE message in fmt #1496
| -rw-r--r-- | core/fmt/fmt.odin | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/core/fmt/fmt.odin b/core/fmt/fmt.odin index 932fc0bb8..360a00b32 100644 --- a/core/fmt/fmt.odin +++ b/core/fmt/fmt.odin @@ -1065,11 +1065,13 @@ fmt_enum :: proc(fi: ^Info, v: any, verb: rune) { case 'i', 'd', 'f': fmt_arg(fi, any{v.data, runtime.type_info_base(e.base).id}, verb) case 's', 'v': - str, ok := enum_value_to_string(v) - if !ok { - str = "%!(BAD ENUM VALUE)" + if str, ok := enum_value_to_string(v); ok { + io.write_string(fi.writer, str) + } else { + io.write_string(fi.writer, "%!(BAD ENUM VALUE=") + fmt_arg(fi, any{v.data, runtime.type_info_base(e.base).id}, 'i') + io.write_string(fi.writer, ")") } - io.write_string(fi.writer, str) } } } |