@yuneta/gobj-js 7.26.14 → 7.26.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3282,13 +3282,20 @@ var gobjJs = (function(exports) {
3282
3282
  }
3283
3283
  /************************************************************
3284
3284
  * JSON.stringify for a log line: a circular object (a gobj,
3285
- * a DOM node) must not make the log call itself throw.
3285
+ * a DOM node), a BigInt or a toJSON() that throws must not make
3286
+ * the log call itself throw -- and neither must the fallback:
3287
+ * String() throws too, on an object with no prototype or with a
3288
+ * toString() that throws.
3286
3289
  ************************************************************/
3287
3290
  function log_stringify(v) {
3288
3291
  try {
3289
3292
  return JSON.stringify(v);
3290
3293
  } catch (e) {
3291
- return String(v);
3294
+ try {
3295
+ return String(v);
3296
+ } catch (e2) {
3297
+ return `<${typeof v}: not printable>`;
3298
+ }
3292
3299
  }
3293
3300
  }
3294
3301
  function format_log(format) {
@@ -5255,17 +5262,6 @@ var gobjJs = (function(exports) {
5255
5262
  return jdb;
5256
5263
  }
5257
5264
  /********************************************
5258
- * A value as json text for a log line: the error path must not throw
5259
- * (a circular record, a BigInt).
5260
- ********************************************/
5261
- function safe_json_text(v) {
5262
- try {
5263
- return JSON.stringify(v);
5264
- } catch (e) {
5265
- return `<${typeof v}: not json (${e.message})>`;
5266
- }
5267
- }
5268
- /********************************************
5269
5265
  *
5270
5266
  ********************************************/
5271
5267
  function jdb_update(jdb, topic_name, path, kw) {
@@ -5275,7 +5271,7 @@ var gobjJs = (function(exports) {
5275
5271
  return null;
5276
5272
  }
5277
5273
  if (!is_object(kw) || empty_string(kw["id"])) {
5278
- log_error(`jdb_update: record without id: ${safe_json_text(kw)}`);
5274
+ log_error(`jdb_update: record without id: ${log_stringify(kw)}`);
5279
5275
  return null;
5280
5276
  }
5281
5277
  if (!is_string(path)) {
@@ -5328,7 +5324,7 @@ var gobjJs = (function(exports) {
5328
5324
  return null;
5329
5325
  }
5330
5326
  if (!is_object(kw) || empty_string(kw["id"])) {
5331
- log_error(`jdb_delete: record without id: ${safe_json_text(kw)}`);
5327
+ log_error(`jdb_delete: record without id: ${log_stringify(kw)}`);
5332
5328
  return null;
5333
5329
  }
5334
5330
  if (!is_string(path)) {