fix source range for last command when engine error (#2757)
* fix source range for last command Signed-off-by: Jess Frazelle <github@jessfraz.com> * add known issues Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * add a comment Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> --------- Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
@ -17,4 +17,11 @@ once fixed in engine will just start working here with no language changes.
|
|||||||
currently move or transform the imported objects at all, once we have assemblies
|
currently move or transform the imported objects at all, once we have assemblies
|
||||||
this will work.
|
this will work.
|
||||||
|
|
||||||
- **Fillets**: Fillets cannot intersect, you will get an error. Only simple fillet cases work currently.
|
- **Fillets**: Fillets cannot intersect, you will get an error. Only simple fillet
|
||||||
|
cases work currently.
|
||||||
|
|
||||||
|
- **Chamfers**: Chamfers cannot intersect, you will get an error. Only simple
|
||||||
|
chamfer cases work currently.
|
||||||
|
|
||||||
|
- **Shell**: Shell is only working for `end` faces, not for `side` or `start`
|
||||||
|
faces. We are tracking the engine side bug on this.
|
||||||
|
2
src/wasm-lib/Cargo.lock
generated
2
src/wasm-lib/Cargo.lock
generated
@ -1375,7 +1375,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kcl-lib"
|
name = "kcl-lib"
|
||||||
version = "0.1.63"
|
version = "0.1.64"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"approx",
|
"approx",
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "kcl-lib"
|
name = "kcl-lib"
|
||||||
description = "KittyCAD Language implementation and tools"
|
description = "KittyCAD Language implementation and tools"
|
||||||
version = "0.1.63"
|
version = "0.1.64"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "https://github.com/KittyCAD/modeling-app"
|
repository = "https://github.com/KittyCAD/modeling-app"
|
||||||
|
@ -216,6 +216,19 @@ pub trait EngineManager: std::fmt::Debug + Send + Sync + 'static {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
WebSocketRequest::ModelingCmdReq { cmd: _, cmd_id } => {
|
WebSocketRequest::ModelingCmdReq { cmd: _, cmd_id } => {
|
||||||
|
// You are probably wondering why we can't just return the source range we were
|
||||||
|
// passed with the function. Well this is actually really important.
|
||||||
|
// If this is the last command in the batch and there is only one and we've reached
|
||||||
|
// the end of the file, this will trigger a flush batch function, but it will just
|
||||||
|
// send default or the end of the file as it's source range not the origin of the
|
||||||
|
// request so we need the original request source range in case the engine returns
|
||||||
|
// an error.
|
||||||
|
let source_range = id_to_source_range.get(&cmd_id).cloned().ok_or_else(|| {
|
||||||
|
KclError::Engine(KclErrorDetails {
|
||||||
|
message: format!("Failed to get source range for command ID: {:?}", cmd_id),
|
||||||
|
source_ranges: vec![],
|
||||||
|
})
|
||||||
|
})?;
|
||||||
let ws_resp = self
|
let ws_resp = self
|
||||||
.inner_send_modeling_cmd(cmd_id, source_range, final_req, id_to_source_range)
|
.inner_send_modeling_cmd(cmd_id, source_range, final_req, id_to_source_range)
|
||||||
.await?;
|
.await?;
|
||||||
|
@ -2245,3 +2245,27 @@ const baseExtrusion = extrude(width, sketch001)
|
|||||||
1.0,
|
1.0,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tokio::test(flavor = "multi_thread")]
|
||||||
|
async fn serial_test_engine_error_source_range_on_last_command() {
|
||||||
|
let code = r#"const sketch001 = startSketchOn('XZ')
|
||||||
|
|> startProfileAt([61.74, 206.13], %)
|
||||||
|
|> xLine(305.11, %, 'seg01')
|
||||||
|
|> yLine(-291.85, %)
|
||||||
|
|> xLine(-segLen('seg01', %), %)
|
||||||
|
|> lineTo([profileStartX(%), profileStartY(%)], %)
|
||||||
|
|> close(%)
|
||||||
|
|> extrude(40.14, %)
|
||||||
|
|> shell({
|
||||||
|
faces: ["seg01"],
|
||||||
|
thickness: 3.14,
|
||||||
|
}, %)
|
||||||
|
"#;
|
||||||
|
|
||||||
|
let result = execute_and_snapshot(code, UnitLength::Mm).await;
|
||||||
|
assert!(result.is_err());
|
||||||
|
assert_eq!(
|
||||||
|
result.err().unwrap().to_string(),
|
||||||
|
r#"engine: KclErrorDetails { source_ranges: [SourceRange([262, 320])], message: "Modeling command failed: [ApiError { error_code: InternalEngine, message: \"Invalid brep after shell operation\" }]" }"#
|
||||||
|
);
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user