diff options
author | Damien George <damien.p.george@gmail.com> | 2018-06-20 21:02:11 +1000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2018-09-20 14:33:10 +1000 |
commit | b01f66c5f1a0ceb14f0a864cd068874ec69258e1 (patch) | |
tree | a61d0f078be5394318dccd948a1c6eb669cbbdfb /py/objstr.c | |
parent | 0a36a80f96e0951e868f1e253b1c82835a9d0918 (diff) |
py: Shorten error messages by using contractions and some rewording.
Diffstat (limited to 'py/objstr.c')
-rw-r--r-- | py/objstr.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/py/objstr.c b/py/objstr.c index d8c2bd117..397e5ccde 100644 --- a/py/objstr.c +++ b/py/objstr.c @@ -1411,7 +1411,7 @@ STATIC mp_obj_t str_modulo_format(mp_obj_t pattern, size_t n_args, const mp_obj_ // Dictionary value lookup if (*str == '(') { if (dict == MP_OBJ_NULL) { - mp_raise_TypeError("format requires a dict"); + mp_raise_TypeError("format needs a dict"); } arg_i = 1; // we used up the single dict argument const byte *key = ++str; @@ -1486,7 +1486,7 @@ incomplete_format: if (arg == MP_OBJ_NULL) { if (arg_i >= n_args) { not_enough_args: - mp_raise_TypeError("not enough arguments for format string"); + mp_raise_TypeError("format string needs more arguments"); } arg = args[arg_i++]; } @@ -1496,14 +1496,14 @@ not_enough_args: size_t slen; const char *s = mp_obj_str_get_data(arg, &slen); if (slen != 1) { - mp_raise_TypeError("%%c requires int or char"); + mp_raise_TypeError("%%c needs int or char"); } mp_print_strn(&print, s, 1, flags, ' ', width); } else if (arg_looks_integer(arg)) { char ch = mp_obj_get_int(arg); mp_print_strn(&print, &ch, 1, flags, ' ', width); } else { - mp_raise_TypeError("integer required"); + mp_raise_TypeError("integer needed"); } break; @@ -1573,7 +1573,7 @@ not_enough_args: } if (arg_i != n_args) { - mp_raise_TypeError("not all arguments converted during string formatting"); + mp_raise_TypeError("format string didn't convert all arguments"); } return mp_obj_new_str_from_vstr(is_bytes ? &mp_type_bytes : &mp_type_str, &vstr); |