aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael McVady <femtonaut@gmail.com>2024-01-02 21:21:56 -0600
committerMichael McVady <femtonaut@gmail.com>2024-01-02 21:21:56 -0600
commit6889931cdb9a7831482779976b1d3bb8d6e23247 (patch)
treecccb56fa16d13489fcda1564be18eca069df9ec9 /src
parent29e921557ec6d275b41cc5e8b729037aa84768b9 (diff)
Handle errors
Diffstat (limited to 'src')
-rw-r--r--src/clog.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/clog.c b/src/clog.c
index 24e08d0..2705558 100644
--- a/src/clog.c
+++ b/src/clog.c
@@ -184,7 +184,9 @@ int get_entry_form(struct http_request *req) {
int post_entry_form(struct http_request *req) {
- struct kore_buf *resp_buf = kore_buf_alloc(0);
+ int err = 0;
+
+ struct kore_buf *resp_buf = NULL;
char *id = NULL;
char *title = NULL;
@@ -204,6 +206,8 @@ int post_entry_form(struct http_request *req) {
kore_log(LOG_INFO, "form body %s.", body);
}
+ resp_buf = kore_buf_alloc(0);
+
// Append form.
kore_buf_appendf(
resp_buf, (const char *) asset_entry_edit_html,
@@ -211,11 +215,11 @@ int post_entry_form(struct http_request *req) {
);
// Render MD.
- (void) render_md(body, resp_buf);
- // if (err == KORE_RESULT_ERROR) {
- // kore_log(LOG_ERR, "Error rendering markdown for entry %s.", id);
- // continue;
- // }
+ err = render_md(body, resp_buf);
+ if (err == KORE_RESULT_ERROR) {
+ kore_buf_append(resp_buf, "Error rendering markdown.", 25);
+ kore_log(LOG_ERR, "Error rendering markdown.");
+ }
http_ok_resp(req, HTTP_STATUS_OK, resp_buf);