Skip to content

Commit

Permalink
misc(proxy-wasm/metrics) minor fix in error message construction
Browse files Browse the repository at this point in the history
If ngx_wa_metrics_get return NGX_ERROR, the error message would end up
with an extra ": ".
  • Loading branch information
casimiro committed Aug 12, 2024
1 parent 9e2477a commit 432b654
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/common/proxy_wasm/ngx_proxy_wasm_host.c
Original file line number Diff line number Diff line change
Expand Up @@ -1702,14 +1702,14 @@ ngx_proxy_wasm_hfuncs_get_metric(ngx_wavm_instance_t *instance,

ngx_memzero(trapmsg, NGX_MAX_ERROR_STR);
p = ngx_sprintf(trapmsg,
"could not retrieve metric id \"%ui\": ",
"could not retrieve metric id \"%ui\"",
metric_id);

if (rc == NGX_DECLINED) {
ngx_sprintf(p, "metric not found");
ngx_sprintf(p, ": metric not found");

} else if (m->type == NGX_WA_METRIC_HISTOGRAM) {
ngx_sprintf(p, "metric is a histogram");
ngx_sprintf(p, ": metric is a histogram");
}

return ngx_proxy_wasm_result_trap(pwexec, (char *) trapmsg,
Expand Down

0 comments on commit 432b654

Please sign in to comment.