@@ -585,12 +585,11 @@ Status Array::open(
585585 array_dir_timestamp_end_,
586586 ArrayDirectoryMode::SCHEMA_ONLY));
587587 }
588- auto && [st, array_schema_latest, array_schemas] = open_for_writes ();
589- throw_if_not_ok (st);
590588
591589 // Set schemas
592- set_array_schema_latest (array_schema_latest.value ());
593- set_array_schemas_all (std::move (array_schemas.value ()));
590+ auto && [array_schema_latest, array_schemas] = open_for_writes ();
591+ set_array_schema_latest (array_schema_latest);
592+ set_array_schemas_all (std::move (array_schemas));
594593
595594 // Set the timestamp
596595 opened_array_->metadata ().reset (timestamp_end_opened_at ());
@@ -606,12 +605,11 @@ Status Array::open(
606605 array_dir_timestamp_end_,
607606 ArrayDirectoryMode::READ));
608607 }
609- auto && [st, latest, array_schemas] = open_for_writes ();
610- throw_if_not_ok (st);
611608
612609 // Set schemas
613- set_array_schema_latest (latest.value ());
614- set_array_schemas_all (std::move (array_schemas.value ()));
610+ auto && [latest, array_schemas] = open_for_writes ();
611+ set_array_schema_latest (latest);
612+ set_array_schemas_all (std::move (array_schemas));
615613
616614 auto version = array_schema_latest ().version ();
617615 if (query_type == QueryType::DELETE &&
@@ -1842,19 +1840,15 @@ Array::open_for_reads_without_fragments() {
18421840}
18431841
18441842tuple<
1845- Status,
1846- optional<shared_ptr<ArraySchema>>,
1847- optional<std::unordered_map<std::string, shared_ptr<ArraySchema>>>>
1843+ shared_ptr<ArraySchema>,
1844+ std::unordered_map<std::string, shared_ptr<ArraySchema>>>
18481845Array::open_for_writes () {
18491846 auto timer_se =
18501847 resources_.stats ().start_timer (" array_open_write_load_schemas" );
18511848 // Checks
1852- if (!resources_.vfs ().supports_uri_scheme (array_uri_))
1853- return {
1854- resources_.logger ()->status (Status_StorageManagerError (
1855- " Cannot open array; URI scheme unsupported." )),
1856- nullopt ,
1857- nullopt };
1849+ if (!resources_.vfs ().supports_uri_scheme (array_uri_)) {
1850+ throw ArrayException (" Cannot open array; URI scheme unsupported." );
1851+ }
18581852
18591853 // Load array schemas
18601854 auto && [array_schema_latest, array_schemas_all] =
@@ -1867,31 +1861,21 @@ Array::open_for_writes() {
18671861 auto version = array_schema_latest->version ();
18681862 if constexpr (is_experimental_build) {
18691863 if (version != constants::format_version) {
1870- std::stringstream err;
1871- err << " Cannot open array for writes; Array format version (" ;
1872- err << version;
1873- err << " ) is not the library format version (" ;
1874- err << constants::format_version << " )" ;
1875- return {
1876- resources_.logger ()->status (Status_StorageManagerError (err.str ())),
1877- nullopt ,
1878- nullopt };
1864+ throw ArrayException (
1865+ " Cannot open array for writes; Array format version (" +
1866+ std::to_string (version) + " ) is not the library format version (" +
1867+ std::to_string (constants::format_version) + " )" );
18791868 }
18801869 } else {
18811870 if (version > constants::format_version) {
1882- std::stringstream err;
1883- err << " Cannot open array for writes; Array format version (" ;
1884- err << version;
1885- err << " ) is newer than library format version (" ;
1886- err << constants::format_version << " )" ;
1887- return {
1888- resources_.logger ()->status (Status_StorageManagerError (err.str ())),
1889- nullopt ,
1890- nullopt };
1871+ throw ArrayException (
1872+ " Cannot open array for writes; Array format version (" +
1873+ std::to_string (version) + " ) is newer than library format version (" +
1874+ std::to_string (constants::format_version) + " )" );
18911875 }
18921876 }
18931877
1894- return {Status::Ok (), array_schema_latest, array_schemas_all};
1878+ return {array_schema_latest, array_schemas_all};
18951879}
18961880
18971881void Array::clear_last_max_buffer_sizes () {
@@ -2326,12 +2310,10 @@ void Array::ensure_array_is_valid_for_delete(const URI& uri) {
23262310void ensure_supported_schema_version_for_read (format_version_t version) {
23272311 // We do not allow reading from arrays written by newer version of TileDB
23282312 if (version > constants::format_version) {
2329- std::stringstream err;
2330- err << " Cannot open array for reads; Array format version (" ;
2331- err << version;
2332- err << " ) is newer than library format version (" ;
2333- err << constants::format_version << " )" ;
2334- throw Status_StorageManagerError (err.str ());
2313+ throw ArrayException (
2314+ " Cannot open array for reads; Array format version (" +
2315+ std::to_string (version) + " ) is newer than library format version (" +
2316+ std::to_string (constants::format_version) + " )" );
23352317 }
23362318}
23372319
0 commit comments