Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standardize error response in three request handlers #1544

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions ldms/src/ldmsd/ldmsd_request.c
Original file line number Diff line number Diff line change
Expand Up @@ -4373,9 +4373,9 @@ static int updtr_task_status_handler(ldmsd_req_ctxt_t reqc)
if (name) {
updtr = ldmsd_updtr_find(name);
if (!updtr) {
reqc->errcode = ENOENT;
cnt = snprintf(reqc->line_buf, reqc->line_len, "updtr '%s' not found", name);
ldmsd_send_error_reply(reqc->xprt, reqc->key.msg_no, ENOENT,
reqc->line_buf, cnt);
ldmsd_send_req_response(reqc, reqc->line_buf);
return 0;
}
rc = __updtr_task_tree_json_obj(reqc, updtr);
Expand Down Expand Up @@ -4427,8 +4427,8 @@ static int updtr_task_status_handler(ldmsd_req_ctxt_t reqc)
goto out;

err:
ldmsd_send_error_reply(reqc->xprt, reqc->key.msg_no, rc,
"internal error", 15);
reqc->errcode = rc;
ldmsd_send_req_response(reqc, "Internal error.");
out:
free(name);
if (updtr)
Expand Down Expand Up @@ -4587,8 +4587,8 @@ static int prdcr_hint_tree_status_handler(ldmsd_req_ctxt_t reqc)
goto out;

intr_err:
ldmsd_send_error_reply(reqc->xprt, reqc->key.msg_no, EINTR,
"interval error", 14);
reqc->errcode = rc;
ldmsd_send_req_response(reqc, "Internal error");
out:
free(name);
if (prdcr)
Expand Down Expand Up @@ -5454,8 +5454,8 @@ static int plugn_sets_handler(ldmsd_req_ctxt_t reqc)
return rc;

err:
ldmsd_send_error_reply(reqc->xprt, reqc->key.msg_no, rc,
"internal error", 15);
reqc->errcode = rc;
ldmsd_send_req_response(reqc, "Internal error.");
goto out;
err0:
ldmsd_send_req_response(reqc, reqc->line_buf);
Expand Down Expand Up @@ -6655,8 +6655,8 @@ static int set_route_handler(ldmsd_req_ctxt_t reqc)
cnt = snprintf(reqc->line_buf, reqc->line_len,
"%s: Set '%s' not exist.",
ldmsd_myname_get(), inst_name);
(void) ldmsd_send_error_reply(reqc->xprt, reqc->key.msg_no, ENOENT,
reqc->line_buf, cnt + 1);
reqc->errcode = ENOENT;
(void) ldmsd_send_req_response(reqc, reqc->line_buf);
goto out;
}

Expand Down
Loading