Skip to content

Commit fb0cee9

Browse files
authored
fix: Update conversion errors (pola-rs#12)
* fix: Update conversion errors * lint * fix-jsunknown-i64-err
1 parent ed11388 commit fb0cee9

File tree

4 files changed

+7
-9
lines changed

4 files changed

+7
-9
lines changed

src/conversion.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ impl FromNapiValue for Wrap<ClosedWindow> {
307307
"right" => ClosedWindow::Right,
308308
_ => {
309309
return Err(napi::Error::from_reason(
310-
"closed should be any of {'none', 'left', 'right'}".to_owned(),
310+
"closed should be any of {'none', 'left', 'right', 'both'}".to_owned(),
311311
))
312312
}
313313
};
@@ -327,7 +327,7 @@ impl FromNapiValue for Wrap<RankMethod> {
327327
"random" => RankMethod::Random,
328328
_ => {
329329
return Err(napi::Error::from_reason(
330-
"use one of 'avg, min, max, dense, ordinal'".to_owned(),
330+
"use one of {'average', 'min', 'max', 'dense', 'ordinal', 'random'}".to_owned(),
331331
))
332332
}
333333
};
@@ -371,7 +371,7 @@ impl FromNapiValue for Wrap<UniqueKeepStrategy> {
371371
"last" => UniqueKeepStrategy::Last,
372372
_ => {
373373
return Err(napi::Error::from_reason(
374-
"use one of 'first, last'".to_owned(),
374+
"use one of {'first', 'last'}".to_owned(),
375375
))
376376
}
377377
};
@@ -387,7 +387,7 @@ impl FromNapiValue for Wrap<NullStrategy> {
387387
"propagate" => NullStrategy::Propagate,
388388
_ => {
389389
return Err(napi::Error::from_reason(
390-
"use one of 'ignore', 'propagate'".to_owned(),
390+
"use one of {'ignore', 'propagate'}".to_owned(),
391391
))
392392
}
393393
};
@@ -403,7 +403,7 @@ impl FromNapiValue for Wrap<NullBehavior> {
403403
"ignore" => NullBehavior::Ignore,
404404
_ => {
405405
return Err(napi::Error::from_reason(
406-
"use one of 'drop', 'ignore'".to_owned(),
406+
"use one of {'drop', 'ignore'}".to_owned(),
407407
))
408408
}
409409
};
@@ -926,7 +926,7 @@ impl FromJsUnknown for i64 {
926926
let s: JsNumber = val.try_into()?;
927927
s.try_into()
928928
}
929-
dt => Err(JsPolarsErr::Other(format!("cannot cast {} to u64", dt)).into()),
929+
dt => Err(JsPolarsErr::Other(format!("cannot cast {} to i64", dt)).into()),
930930
}
931931
}
932932
}

src/lazy/dataframe.rs

-1
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,6 @@ pub fn scan_ipc(path: String, options: ScanIPCOptions) -> napi::Result<JsLazyFra
671671
Ok(lf.into())
672672
}
673673

674-
675674
#[napi(object)]
676675
pub struct JsonScanOptions {
677676
pub infer_schema_length: Option<i64>,

src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ pub mod lazy;
2525
pub mod list_construction;
2626
pub mod prelude;
2727
pub mod series;
28-
pub mod utils;
2928
pub mod set;
29+
pub mod utils;
3030

3131
pub use polars_core;
3232

src/series.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1158,7 +1158,6 @@ impl JsSeries {
11581158
}
11591159
}
11601160

1161-
11621161
macro_rules! impl_set_with_mask_wrap {
11631162
($name:ident, $native:ty, $cast:ident) => {
11641163
#[napi]

0 commit comments

Comments
 (0)