From 4b9e6d209d82417450fe504733e3fc4e945f7293 Mon Sep 17 00:00:00 2001 From: Sami Vaarala Date: Fri, 28 Oct 2016 22:31:43 +0300 Subject: [PATCH] 2.0 migration notes: duk_error() etc changes --- doc/release-notes-v2-0.rst | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/doc/release-notes-v2-0.rst b/doc/release-notes-v2-0.rst index 27ef9155..11cb8601 100644 --- a/doc/release-notes-v2-0.rst +++ b/doc/release-notes-v2-0.rst @@ -601,6 +601,23 @@ To upgrade: to accept also ``TypeError`` or ``RangeError``. (In general depending on a specific error type should be only be done when it's absolute necessary.) +duk_error(), duk_error_va(), duk_throw(), duk_fatal() have a return value +------------------------------------------------------------------------- + +The prototype return value for these error throwers was changed from ``void`` +to ``duk_ret_t`` which allows for idioms like:: + + if (argvalue < 0) { + return duk_error(ctx, DUK_ERR_TYPE_ERROR, + "invalid arg: %d", (int) argvalue); + } + +To upgrade: + +* Without an explicit cast to ``(void) duk_error(...)`` you may get some new + compiler warnings. Fix by adding the void cast, or convert the call sites + to use the ``return duk_error(...)`` idiom where applicable. + duk_dump_context_stdout() and duk_dump_context_stderr() removed ---------------------------------------------------------------