diff options
author | Christian Grothoff <grothoff@gnunet.org> | 2021-07-28 09:39:30 +0200 |
---|---|---|
committer | Christian Grothoff <grothoff@gnunet.org> | 2021-07-28 09:40:22 +0200 |
commit | 8175353f1f9966c0125b89a3cb3e3352de54a5ff (patch) | |
tree | aa786e8a20d5ddefa9f8347b6dd926320dd0d766 /src/json | |
parent | 28dfb1220bd257ba29fc2ae786c6952cc086c561 (diff) | |
download | gnunet-8175353f1f9966c0125b89a3cb3e3352de54a5ff.tar.gz gnunet-8175353f1f9966c0125b89a3cb3e3352de54a5ff.zip |
-nicer logging
Diffstat (limited to 'src/json')
-rw-r--r-- | src/json/json_pack.c | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/src/json/json_pack.c b/src/json/json_pack.c index 88edaca5f..e104ad602 100644 --- a/src/json/json_pack.c +++ b/src/json/json_pack.c | |||
@@ -148,7 +148,13 @@ GNUNET_JSON_pack_object_steal (const char *name, | |||
148 | 148 | ||
149 | if (NULL == o) | 149 | if (NULL == o) |
150 | return ps; | 150 | return ps; |
151 | GNUNET_assert (json_is_object (o)); | 151 | if (! json_is_object (o)) |
152 | { | ||
153 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
154 | "Expected JSON object for field `%s'\n", | ||
155 | name); | ||
156 | GNUNET_assert (0); | ||
157 | } | ||
152 | return ps; | 158 | return ps; |
153 | } | 159 | } |
154 | 160 | ||
@@ -165,7 +171,13 @@ GNUNET_JSON_pack_object_incref (const char *name, | |||
165 | if (NULL == o) | 171 | if (NULL == o) |
166 | return ps; | 172 | return ps; |
167 | (void) json_incref (o); | 173 | (void) json_incref (o); |
168 | GNUNET_assert (json_is_object (o)); | 174 | if (! json_is_object (o)) |
175 | { | ||
176 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
177 | "Expected JSON object for field `%s'\n", | ||
178 | name); | ||
179 | GNUNET_assert (0); | ||
180 | } | ||
169 | return ps; | 181 | return ps; |
170 | } | 182 | } |
171 | 183 | ||
@@ -181,7 +193,13 @@ GNUNET_JSON_pack_array_steal (const char *name, | |||
181 | 193 | ||
182 | if (NULL == a) | 194 | if (NULL == a) |
183 | return ps; | 195 | return ps; |
184 | GNUNET_assert (json_is_array (a)); | 196 | if (! json_is_array (a)) |
197 | { | ||
198 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
199 | "Expected JSON array for field `%s'\n", | ||
200 | name); | ||
201 | GNUNET_assert (0); | ||
202 | } | ||
185 | return ps; | 203 | return ps; |
186 | } | 204 | } |
187 | 205 | ||
@@ -198,7 +216,13 @@ GNUNET_JSON_pack_array_incref (const char *name, | |||
198 | if (NULL == a) | 216 | if (NULL == a) |
199 | return ps; | 217 | return ps; |
200 | (void) json_incref (a); | 218 | (void) json_incref (a); |
201 | GNUNET_assert (json_is_array (a)); | 219 | if (! json_is_array (a)) |
220 | { | ||
221 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
222 | "Expected JSON array for field `%s'\n", | ||
223 | name); | ||
224 | GNUNET_assert (0); | ||
225 | } | ||
202 | return ps; | 226 | return ps; |
203 | } | 227 | } |
204 | 228 | ||