Raise appropriate errors for mj_addBufferVFS in Python bindings.
When loading models in the XML bindings, different issues with the asset dictionary were all reported as "assets dict is too big". PiperOrigin-RevId: 670960339 Change-Id: I2e47d91a6b433fd90ebdf9960a9b5b47413af410
This commit is contained in:
committed by
Copybara-Service
parent
e9a85764ea
commit
9a27fc14c2
@@ -345,7 +345,13 @@ static raw::MjModel* LoadModelFileImpl(
|
||||
const int vfs_error = InterceptMjErrors(mj_addBufferVFS)(
|
||||
vfs_ptr, buffer_name.c_str(), asset.content, asset.content_size);
|
||||
if (vfs_error) {
|
||||
throw py::value_error("assets dict is too big");
|
||||
mj_deleteVFS(vfs_ptr);
|
||||
if (vfs_error == 2) {
|
||||
throw py::value_error("Repeated file name in assets dict: " +
|
||||
buffer_name);
|
||||
} else {
|
||||
throw py::value_error("Asset failed to load: " + buffer_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user