Skip to content

Commit d815cc5

Browse files
committed
Throw errors in JSON/HDF5 when supplying memory selection
1 parent b6d64d6 commit d815cc5

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

src/IO/HDF5/HDF5IOHandler.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1517,6 +1517,13 @@ void HDF5IOHandlerImpl::writeDataset(
15171517
"[HDF5] Writing into a dataset in a file opened as read only is "
15181518
"not possible.");
15191519

1520+
if (parameters.memorySelection.has_value())
1521+
{
1522+
throw error::OperationUnsupportedInBackend(
1523+
"HDF5",
1524+
"Non-contiguous memory selections not supported in HDF5 backend.");
1525+
}
1526+
15201527
auto res = getFile(writable);
15211528
File file = res ? res.value() : getFile(writable->parent).value();
15221529

src/IO/JSON/JSONIOHandlerImpl.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -872,6 +872,13 @@ void JSONIOHandlerImpl::writeDataset(
872872
access::write(m_handler->m_backendAccess),
873873
"[JSON] Cannot write data in read-only mode.");
874874

875+
if (parameters.memorySelection.has_value())
876+
{
877+
throw error::OperationUnsupportedInBackend(
878+
"JSON",
879+
"Non-contiguous memory selections not supported in JSON backend.");
880+
}
881+
875882
auto pos = setAndGetFilePosition(writable);
876883
auto file = refreshFileFromParent(writable);
877884
auto &j = obtainJsonContents(writable);

0 commit comments

Comments
 (0)