mirror of
https://github.com/katanemo/plano.git
synced 2026-05-30 14:25:15 +02:00
improve cluster not configured error (#73)
* improve cluster not configured error * dont panic * update format * Merge branch 'main' into adil/fix_salman_docs
This commit is contained in:
parent
16a8927889
commit
dd8c43a392
1 changed files with 9 additions and 3 deletions
|
|
@ -497,12 +497,13 @@ impl StreamContext {
|
||||||
debug!("tool_name(s): {:?}", tool_names);
|
debug!("tool_name(s): {:?}", tool_names);
|
||||||
debug!("tool_params: {}", tool_params_json_str);
|
debug!("tool_params: {}", tool_params_json_str);
|
||||||
|
|
||||||
let endpoint = prompt_target.endpoint.as_ref().unwrap();
|
let endpoint = prompt_target.endpoint.unwrap();
|
||||||
|
let path = endpoint.path.unwrap_or(String::from("/"));
|
||||||
let token_id = match self.dispatch_http_call(
|
let token_id = match self.dispatch_http_call(
|
||||||
&endpoint.cluster,
|
&endpoint.cluster,
|
||||||
vec![
|
vec![
|
||||||
(":method", "POST"),
|
(":method", "POST"),
|
||||||
(":path", endpoint.path.as_ref().unwrap_or(&"/".to_string())),
|
(":path", path.as_ref()),
|
||||||
(":authority", endpoint.cluster.as_str()),
|
(":authority", endpoint.cluster.as_str()),
|
||||||
("content-type", "application/json"),
|
("content-type", "application/json"),
|
||||||
("x-envoy-max-retries", "3"),
|
("x-envoy-max-retries", "3"),
|
||||||
|
|
@ -513,7 +514,12 @@ impl StreamContext {
|
||||||
) {
|
) {
|
||||||
Ok(token_id) => token_id,
|
Ok(token_id) => token_id,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
panic!("Error dispatching HTTP call for function_resolver: {:?}", e);
|
let error_msg = format!(
|
||||||
|
"Error dispatching call to cluster: {}, path: {}, err: {:?}",
|
||||||
|
&endpoint.cluster, path, e
|
||||||
|
);
|
||||||
|
debug!("{}", error_msg);
|
||||||
|
return self.send_server_error(error_msg, Some(StatusCode::BAD_REQUEST));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue