Stronger types and better error handling in executeMock (#7370)

This brings the `execute_mock` function into line with the `execute` function, which I tweaked in https://github.com/KittyCAD/modeling-app/pull/7351. Now mock execution, like real execution, will always return a properly-formatted KCL error, instead of any possible JS value.

Also, incidentally, I noticed that send_response always succeeds, so I changed it from Result<()> to void.
This commit is contained in:
Adam Chalmers
2025-06-04 17:24:24 -05:00
committed by GitHub
parent 4502ad62b2
commit c25dfabc94
3 changed files with 55 additions and 31 deletions

View File

@ -220,6 +220,7 @@ impl schemars::JsonSchema for TypedPath {
///
/// * Does **not** touch `..` or symlinks call `canonicalize()` if you need that.
/// * Returns an owned `PathBuf` only when normalisation was required.
#[cfg(not(target_arch = "wasm32"))]
fn normalise_import<S: AsRef<str>>(raw: S) -> std::path::PathBuf {
let s = raw.as_ref();
// On Unix we need to swap `\` → `/`. On Windows we leave it alone.