1
0
mirror of https://github.com/janet-lang/janet synced 2024-12-26 08:20:27 +00:00

Improved various error messages when handling unexpected types.

error: bad slot #1, expected string|symbol|keyword|buffer, got ...
error: bad slot #1, expected a string, symbol, keyword or buffer, got ...

bad s64 initializer: "donkey"
can not convert string "donkey" to s64
This commit is contained in:
Ico Doornekamp 2023-05-22 18:44:27 +02:00
parent 57b751b994
commit b4e3dbf331
2 changed files with 3 additions and 3 deletions

View File

@ -138,7 +138,7 @@ int64_t janet_unwrap_s64(Janet x) {
break; break;
} }
} }
janet_panicf("bad s64 initializer: %t", x); janet_panicf("can not convert %t %q to 64 bit signed integer", x, x);
return 0; return 0;
} }
@ -169,7 +169,7 @@ uint64_t janet_unwrap_u64(Janet x) {
break; break;
} }
} }
janet_panicf("bad u64 initializer: %t", x); janet_panicf("can not convert %t %q to a 64 bit unsigned integer", x, x);
return 0; return 0;
} }

View File

@ -736,7 +736,7 @@ static void pushtypes(JanetBuffer *buffer, int types) {
if (first) { if (first) {
first = 0; first = 0;
} else { } else {
janet_buffer_push_u8(buffer, '|'); janet_buffer_push_cstring(buffer, (types == 1) ? " or " : ", ");
} }
janet_buffer_push_cstring(buffer, janet_type_names[i]); janet_buffer_push_cstring(buffer, janet_type_names[i]);
} }