From d26b01d4bd42c7cf6fc455406b3cfd696465f652 Mon Sep 17 00:00:00 2001 From: ZyX Date: Mon, 4 Jan 2016 17:20:16 +0300 Subject: eval: Use better error messages when failing to dump values Examples: let g:SR = [[]] call add(g:SR[0], g:SR) wshada " E952: Unable to dump variable g:SR: container references itself in index 0, index 0 let g:F = {'_TYPE': v:msgpack_types.map, '_VAL': [[{'abc': 1}, function("tr")]]} wshada " E951: Error while dumping variable g:F, key {'abc': 1} at index 0 from special map, key '': attempt to dump function reference " (no msgpack#string available) " E951: Error while dumping variable g:F, key {="abc": 1} at index 0 from special map, key '': attempt to dump function reference " (msgpack#string available) let g:F = {'_TYPE': v:msgpack_types.map, '_VAL': [[g:SR, function("tr")]]} wshada " E951: Error while dumping variable g:F, key [[[[{E724@0}]]]] at index 0 from special map, index 1: attempt to dump function reference call msgpackdump([g:SR]) " E952: Unable to dump msgpackdump() argument, index 0: container references itself in index 0, index 0 Not tested yet. --- src/nvim/eval.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/nvim/eval.h') diff --git a/src/nvim/eval.h b/src/nvim/eval.h index 19a1bbb083..ea8b5bc253 100644 --- a/src/nvim/eval.h +++ b/src/nvim/eval.h @@ -118,7 +118,8 @@ enum { /// Maximum number of function arguments #define MAX_FUNC_ARGS 20 -int vim_to_msgpack(msgpack_packer *const, typval_T *const); +int vim_to_msgpack(msgpack_packer *const, typval_T *const, + const char *const objname); #ifdef INCLUDE_GENERATED_DECLARATIONS # include "eval.h.generated.h" -- cgit