Improve error messages around PI and other numbers with unknown units (#7457)
* Improve docs around PI Signed-off-by: Nick Cameron <nrc@ncameron.org> * Refactor and polish type error messages Signed-off-by: Nick Cameron <nrc@ncameron.org> * Add suggestion to fix unknown numbers error Signed-off-by: Nick Cameron <nrc@ncameron.org> * Don't warn so often about unknown units Signed-off-by: Nick Cameron <nrc@ncameron.org> --------- Signed-off-by: Nick Cameron <nrc@ncameron.org>
This commit is contained in:
@ -1230,7 +1230,10 @@ secondSketch = startSketchOn(part001, face = '')
|
||||
let result = execute_and_snapshot(code, None).await;
|
||||
let err = result.unwrap_err();
|
||||
let err = err.as_kcl_error().unwrap();
|
||||
assert_eq!(err.message(), "face requires a value with type `tag`, but found string");
|
||||
assert_eq!(
|
||||
err.message(),
|
||||
"face requires a value with type `tag`, but found a value with type `string`."
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
@ -1962,7 +1965,7 @@ someFunction('INVALID')
|
||||
let err = err.as_kcl_error().unwrap();
|
||||
assert_eq!(
|
||||
err.message(),
|
||||
"The input argument of `startSketchOn` requires a value with type `Solid | Plane`, but found string"
|
||||
"The input argument of `startSketchOn` requires a value with type `Solid` or a value with type `Plane` (`Solid | Plane`), but found a value with type `string`."
|
||||
);
|
||||
assert_eq!(
|
||||
err.source_ranges(),
|
||||
@ -2087,7 +2090,7 @@ async fn kcl_test_better_type_names() {
|
||||
},
|
||||
None => todo!(),
|
||||
};
|
||||
assert_eq!(err, "This function expected the input argument to be one or more Solids or imported geometry but it's actually of type Sketch. You can convert a sketch (2D) into a Solid (3D) by calling a function like `extrude` or `revolve`");
|
||||
assert_eq!(err, "This function expected the input argument to be one or more Solids or ImportedGeometry but it's actually of type Sketch. You can convert a sketch (2D) into a Solid (3D) by calling a function like `extrude` or `revolve`");
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
|
Reference in New Issue
Block a user