Subject: bug#48228: json-serialize should signal error when dll is not found [MS Windows]

From: Lars Ingebrigtsen <[email-masked]>
Date: Tue, 20 Jul 2021 14:50:01 +0200

Dmitry Gutov <[email-masked]> writes:

> As discussed on Emacs Help.
>
> Another commenter suggested signaling a specific error. Please advise
> what to name it and where to put it.
>
> diff --git a/src/json.c b/src/json.c
> index 3f1d27ad7f..ece057ae41 100644
> --- a/src/json.c
> +++ b/src/json.c
> @@ -596,8 +596,7 @@ DEFUN ("json-serialize", Fjson_serialize,
> Sjson_serialize, 1, MANY,
>      }
>    if (!json_initialized)
>      {
> -      message1 ("jansson library not found");
> -      return Qnil;
> +      Fsignal (Qerror, list1 (build_unibyte_string ("jansson library
> not found")));

I've now applied a version of this change to Emacs 28 (with a new error
symbol).

The discussion here then turned towards the question of whether there
should be a `json-available-p' function, and there should.  But json.c
is slightly unusual in this respect that it's not compiled at all if
jansson isn't available, so the function will have to go somewhere else,
which is rather, er, inconvenient.

Anybody have an idea how to solve that problem?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no