@@ -115,17 +115,17 @@ impl crate::cmd::Command for CmdKclExport {
115115 let settings = get_modeling_settings_from_project_toml ( & filepath) ?;
116116
117117 let program = kcl_lib:: Program :: parse_no_errs ( & code)
118- . map_err ( |err| kcl_error_fmt:: KclError :: new ( code . to_string ( ) , err) ) ?;
118+ . map_err ( |err| kcl_error_fmt:: into_miette_for_parse ( & filepath . display ( ) . to_string ( ) , & code , err) ) ?;
119119 let meta_settings = program. meta_settings ( ) ?. unwrap_or_default ( ) ;
120120 let units: kcl_lib:: UnitLength = meta_settings. default_length_units . into ( ) ;
121121
122122 let mut state = kcl_lib:: ExecState :: new ( & settings) ;
123123 let client = ctx. api_client ( "" ) ?;
124124 let ectx = kcl_lib:: ExecutorContext :: new ( & client, settings) . await ?;
125125 let session_data = ectx
126- . run ( & program, & mut state)
126+ . run_with_ui_outputs ( & program, & mut state)
127127 . await
128- . map_err ( |err| kcl_error_fmt:: KclError :: new ( code. to_string ( ) , err) ) ?
128+ . map_err ( |err| kcl_error_fmt:: into_miette ( & code, err) ) ?
129129 . 1 ;
130130
131131 // Zoom on the object.
@@ -152,7 +152,7 @@ impl crate::cmd::Command for CmdKclExport {
152152 } ) ,
153153 )
154154 . await
155- . map_err ( |err| kcl_error_fmt:: KclError :: new ( code . to_string ( ) , err) ) ?;
155+ . map_err ( |err| kcl_error_fmt:: into_miette_for_parse ( & filepath . display ( ) . to_string ( ) , & code , err) ) ?;
156156
157157 if let kittycad_modeling_cmds:: websocket:: OkWebSocketResponseData :: Export { files } = resp {
158158 // Save the files to our export directory.
@@ -355,6 +355,7 @@ impl crate::cmd::Command for CmdKclSnapshot {
355355 let ( resp, session_data) = ctx
356356 . send_kcl_modeling_cmd (
357357 "" ,
358+ & filepath. display ( ) . to_string ( ) ,
358359 & code,
359360 kittycad_modeling_cmds:: ModelingCmd :: TakeSnapshot ( kittycad_modeling_cmds:: TakeSnapshot {
360361 format : output_format,
@@ -429,6 +430,7 @@ impl crate::cmd::Command for CmdKclView {
429430 let ( resp, _session_data) = ctx
430431 . send_kcl_modeling_cmd (
431432 "" ,
433+ & filepath. display ( ) . to_string ( ) ,
432434 & code,
433435 kittycad_modeling_cmds:: ModelingCmd :: TakeSnapshot ( kittycad_modeling_cmds:: TakeSnapshot {
434436 format : kittycad_modeling_cmds:: ImageFormat :: Png ,
@@ -583,6 +585,7 @@ impl crate::cmd::Command for CmdKclVolume {
583585 let ( resp, session_data) = ctx
584586 . send_kcl_modeling_cmd (
585587 "" ,
588+ & filepath. display ( ) . to_string ( ) ,
586589 & code,
587590 kittycad_modeling_cmds:: ModelingCmd :: Volume ( kittycad_modeling_cmds:: Volume {
588591 entity_ids : vec ! [ ] , // get whole model
@@ -667,6 +670,7 @@ impl crate::cmd::Command for CmdKclMass {
667670 let ( resp, session_data) = ctx
668671 . send_kcl_modeling_cmd (
669672 "" ,
673+ & filepath. display ( ) . to_string ( ) ,
670674 & code,
671675 kittycad_modeling_cmds:: ModelingCmd :: Mass ( kittycad_modeling_cmds:: Mass {
672676 entity_ids : vec ! [ ] , // get whole model
@@ -741,6 +745,7 @@ impl crate::cmd::Command for CmdKclCenterOfMass {
741745 let ( resp, session_data) = ctx
742746 . send_kcl_modeling_cmd (
743747 "" ,
748+ & filepath. display ( ) . to_string ( ) ,
744749 & code,
745750 kittycad_modeling_cmds:: ModelingCmd :: CenterOfMass ( kittycad_modeling_cmds:: CenterOfMass {
746751 entity_ids : vec ! [ ] , // get whole model
@@ -825,6 +830,7 @@ impl crate::cmd::Command for CmdKclDensity {
825830 let ( resp, session_data) = ctx
826831 . send_kcl_modeling_cmd (
827832 "" ,
833+ & filepath. display ( ) . to_string ( ) ,
828834 & code,
829835 kittycad_modeling_cmds:: ModelingCmd :: Density ( kittycad_modeling_cmds:: Density {
830836 entity_ids : vec ! [ ] , // get whole model
@@ -899,6 +905,7 @@ impl crate::cmd::Command for CmdKclSurfaceArea {
899905 let ( resp, session_data) = ctx
900906 . send_kcl_modeling_cmd (
901907 "" ,
908+ & filepath. display ( ) . to_string ( ) ,
902909 & code,
903910 kittycad_modeling_cmds:: ModelingCmd :: SurfaceArea ( kittycad_modeling_cmds:: SurfaceArea {
904911 entity_ids : vec ! [ ] , // get whole model
0 commit comments