Mercurial > hgrepos > Python > libs > ConfigMix
changeset 630:33264c660fca
Exception formatting: more into into some exception error messages
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Sun, 16 Jan 2022 09:46:57 +0100 |
| parents | 2426fa273a29 |
| children | 8efdb6357428 |
| files | configmix/_speedups.c |
| diffstat | 1 files changed, 6 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/configmix/_speedups.c Fri Jan 14 11:59:48 2022 +0100 +++ b/configmix/_speedups.c Sun Jan 16 09:46:57 2022 +0100 @@ -63,7 +63,7 @@ r += (c - 55); } else { - PyErr_SetString(PyExc_ValueError, "invalid base-16 literal"); + PyErr_Format(PyExc_ValueError, "invalid base-16 literal: %c", (int)c); return -1; } } @@ -333,14 +333,14 @@ pb = PyList_GetItem(parts, i); /* borrowed */ pb_len = PyUnicode_GetLength(pb); if (pb_len < 1) { - PyErr_SetString(PyExc_ValueError, "unknown quote syntax string"); + PyErr_Format(PyExc_ValueError, "quote syntax: length too small: %U", pb); goto error; } c = PyUnicode_ReadChar(pb, 0); switch (c) { case 0x55: /* U */ if (pb_len < 9) { - PyErr_SetString(PyExc_ValueError, "quote syntax: length too small"); + PyErr_Format(PyExc_ValueError, "quote syntax: length too small: %U", pb); goto error; } o = _hex2string(pb, 9); @@ -356,7 +356,7 @@ break; case 0x75: /* u */ if (pb_len < 5) { - PyErr_SetString(PyExc_ValueError, "quote syntax: length too small"); + PyErr_Format(PyExc_ValueError, "quote syntax: length too small: %U", pb); goto error; } o = _hex2string(pb, 5); @@ -372,7 +372,7 @@ break; case 0x78: /* x */ if (pb_len < 3) { - PyErr_SetString(PyExc_ValueError, "quote syntax: length too small"); + PyErr_Format(PyExc_ValueError, "quote syntax: length too small: %U", pb); goto error; } o = _hex2string(pb, 3); @@ -388,7 +388,7 @@ break; default: - PyErr_SetString(PyExc_ValueError, "unknown quote syntax string"); + PyErr_Format(PyExc_ValueError, "quote syntax: length too small: %U", pb); goto error; } }
