mirror of
https://github.com/chirpstack/chirpstack.git
synced 2025-05-28 21:44:15 +00:00
Fix "Error converting from js 'float' into type 'i32'" error.
This commit is contained in:
parent
90c5af20df
commit
331f4bce40
@ -170,7 +170,11 @@ pub async fn encode(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let v: Vec<u8> = res.get("bytes")?;
|
// Directly into u8 can result into the following error:
|
||||||
|
// Error converting from js 'float' into type 'i32'
|
||||||
|
let v: Vec<f64> = res.get("bytes")?;
|
||||||
|
let v: Vec<u8> = v.iter().map(|v| *v as u8).collect();
|
||||||
|
|
||||||
Ok(v)
|
Ok(v)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -89,9 +89,7 @@ pub async fn struct_to_binary(
|
|||||||
Ok(match codec {
|
Ok(match codec {
|
||||||
Codec::NONE => Vec::new(),
|
Codec::NONE => Vec::new(),
|
||||||
Codec::CAYENNE_LPP => cayenne_lpp::encode(obj).context("CayenneLpp encode")?,
|
Codec::CAYENNE_LPP => cayenne_lpp::encode(obj).context("CayenneLpp encode")?,
|
||||||
Codec::JS => js::encode(f_port, variables, encoder_config, obj)
|
Codec::JS => js::encode(f_port, variables, encoder_config, obj).await?,
|
||||||
.await
|
|
||||||
.context("JavaScript encoder")?,
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user