From 5c9860a0a2bf27d409c986673f0a74542561c4c3 Mon Sep 17 00:00:00 2001 From: Sander Bosma Date: Wed, 1 Mar 2017 10:43:47 +0100 Subject: api: Do not truncate errors <1 MB. #6237 Closes #5984 --- scripts/gendispatch.lua | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'scripts') diff --git a/scripts/gendispatch.lua b/scripts/gendispatch.lua index 45a4f4a4de..683962aa60 100644 --- a/scripts/gendispatch.lua +++ b/scripts/gendispatch.lua @@ -225,8 +225,7 @@ for i = 1, #functions do end output:write('\n') output:write('\n if (args.size != '..#fn.parameters..') {') - output:write('\n snprintf(error->msg, sizeof(error->msg), "Wrong number of arguments: expecting '..#fn.parameters..' but got %zu", args.size);') - output:write('\n error->set = true;') + output:write('\n _api_set_error(error, error->type, "Wrong number of arguments: expecting '..#fn.parameters..' but got %zu", args.size);') output:write('\n goto cleanup;') output:write('\n }\n') @@ -251,8 +250,7 @@ for i = 1, #functions do output:write('\n '..converted..' = (handle_T)args.items['..(j - 1)..'].data.integer;') end output:write('\n } else {') - output:write('\n snprintf(error->msg, sizeof(error->msg), "Wrong type for argument '..j..', expecting '..param[1]..'");') - output:write('\n error->set = true;') + output:write('\n _api_set_error(error, error->type, "Wrong type for argument '..j..', expecting '..param[1]..'");') output:write('\n goto cleanup;') output:write('\n }\n') else -- cgit From 2ed91f222f1dddda10fbdc9cb80df2be7d4c2da3 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 23 Apr 2017 19:58:13 +0200 Subject: api/internal: Remove `set` field from Error type. --- scripts/gendispatch.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/gendispatch.lua b/scripts/gendispatch.lua index 683962aa60..53af67cce4 100644 --- a/scripts/gendispatch.lua +++ b/scripts/gendispatch.lua @@ -225,7 +225,7 @@ for i = 1, #functions do end output:write('\n') output:write('\n if (args.size != '..#fn.parameters..') {') - output:write('\n _api_set_error(error, error->type, "Wrong number of arguments: expecting '..#fn.parameters..' but got %zu", args.size);') + output:write('\n _api_set_error(error, kErrorTypeException, "Wrong number of arguments: expecting '..#fn.parameters..' but got %zu", args.size);') output:write('\n goto cleanup;') output:write('\n }\n') @@ -250,7 +250,7 @@ for i = 1, #functions do output:write('\n '..converted..' = (handle_T)args.items['..(j - 1)..'].data.integer;') end output:write('\n } else {') - output:write('\n _api_set_error(error, error->type, "Wrong type for argument '..j..', expecting '..param[1]..'");') + output:write('\n _api_set_error(error, kErrorTypeException, "Wrong type for argument '..j..', expecting '..param[1]..'");') output:write('\n goto cleanup;') output:write('\n }\n') else @@ -290,7 +290,7 @@ for i = 1, #functions do output:write('error);\n') end -- and check for the error - output:write('\n if (error->set) {') + output:write('\n if (ERROR_SET(error)) {') output:write('\n goto cleanup;') output:write('\n }\n') else -- cgit From 3fbc660d57f4726044662bde1bf52c527e45fb98 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 23 Apr 2017 21:54:44 +0200 Subject: api_set_error(): rename --- scripts/gendispatch.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/gendispatch.lua b/scripts/gendispatch.lua index 53af67cce4..0ee3ae6475 100644 --- a/scripts/gendispatch.lua +++ b/scripts/gendispatch.lua @@ -225,7 +225,7 @@ for i = 1, #functions do end output:write('\n') output:write('\n if (args.size != '..#fn.parameters..') {') - output:write('\n _api_set_error(error, kErrorTypeException, "Wrong number of arguments: expecting '..#fn.parameters..' but got %zu", args.size);') + output:write('\n api_set_error(error, kErrorTypeException, "Wrong number of arguments: expecting '..#fn.parameters..' but got %zu", args.size);') output:write('\n goto cleanup;') output:write('\n }\n') @@ -250,7 +250,7 @@ for i = 1, #functions do output:write('\n '..converted..' = (handle_T)args.items['..(j - 1)..'].data.integer;') end output:write('\n } else {') - output:write('\n _api_set_error(error, kErrorTypeException, "Wrong type for argument '..j..', expecting '..param[1]..'");') + output:write('\n api_set_error(error, kErrorTypeException, "Wrong type for argument '..j..', expecting '..param[1]..'");') output:write('\n goto cleanup;') output:write('\n }\n') else -- cgit