From 689c60b82ae8166b9dbe4b658ebee84883b02836 Mon Sep 17 00:00:00 2001 From: Isaiah Norton Date: Thu, 16 Jul 2020 22:31:05 -0400 Subject: [PATCH] Use std::invalid_argument -> ValueError for config errors --- tiledb/core.cc | 6 +++--- tiledb/tests/test_core.py | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tiledb/core.cc b/tiledb/core.cc index 458f85a21e..bde463dc35 100644 --- a/tiledb/core.cc +++ b/tiledb/core.cc @@ -269,7 +269,7 @@ class PyQuery { std::stoull(tmp_str); } catch (const std::invalid_argument &e) { (void)e; - throw TileDBError("Failed to convert 'py.init_buffer_bytes' to uint64_t ('" + tmp_str + "')"); + throw std::invalid_argument("Failed to convert 'py.init_buffer_bytes' to uint64_t ('" + tmp_str + "')"); } } @@ -280,7 +280,7 @@ class PyQuery { std::stoull(tmp_str); } catch (const std::invalid_argument &e) { (void)e; - throw TileDBError("Failed to convert 'py.exp_alloc_max_bytes' to uint64_t ('" + tmp_str + "')"); + throw std::invalid_argument("Failed to convert 'py.exp_alloc_max_bytes' to uint64_t ('" + tmp_str + "')"); } } @@ -291,7 +291,7 @@ class PyQuery { } else if (tmp_str == "false") { deduplicate_ = false; } else { - throw TileDBError("Failed to convert configuration 'py.deduplicate' to bool ('" + tmp_str + "')"); + throw std::invalid_argument("Failed to convert configuration 'py.deduplicate' to bool ('" + tmp_str + "')"); } } diff --git a/tiledb/tests/test_core.py b/tiledb/tests/test_core.py index 13560571ec..d9da49b518 100644 --- a/tiledb/tests/test_core.py +++ b/tiledb/tests/test_core.py @@ -16,6 +16,10 @@ def test_pyquery_basic(self): pass with tiledb.open(uri) as a: + with self.assertRaises(ValueError): + testctx = tiledb.Ctx(config={'py.init_buffer_bytes': 'abcd'}) + core.PyQuery(testctx, a, ("",), False, 0) + q = core.PyQuery(ctx, a, ("",), False, 0) try: