| 704 | } |
| 705 | |
| 706 | static char *error_json(const char *message, int code, int *status) { |
| 707 | if (status) |
| 708 | *status = code; |
| 709 | yyjson_mut_doc *doc = yyjson_mut_doc_new(NULL); |
| 710 | if (!doc) |
| 711 | return NULL; |
| 712 | yyjson_mut_val *root = yyjson_mut_obj(doc); |
| 713 | yyjson_mut_doc_set_root(doc, root); |
| 714 | json_string(doc, root, "error", message); |
| 715 | char *json = yyjson_mut_write_opts(doc, 0, cbm_json_writer_allocator(), NULL, NULL); |
| 716 | yyjson_mut_doc_free(doc); |
| 717 | return json; |
| 718 | } |
| 719 | |
| 720 | /* An unchanged value is not rewritten: the UPDATE would still fire the revision |
| 721 | * trigger, so every `daemon start` on a UI build committed (journal + fsync) and |
no test coverage detected