Skip to content

Commit 6005e69

Browse files
committed
Handle exceptions correctly in Realm2JSON tool
1 parent 8f54801 commit 6005e69

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
* Update libuv used in object store tests from v1.35.0 to v1.48.0 ([PR #7508](https://github.com/realm/realm-core/pull/7508)).
2121
* Made `set_default_logger` nullable in the bindgen spec.yml (PR [#7515](https://github.com/realm/realm-core/pull/7515)).
2222
* Added `App::default_base_url()` static accessor for SDKs to retrieve the default base URL from Core. ([PR #7534](https://github.com/realm/realm-core/pull/7534))
23+
* Realm2JSON tool will now correctly upgrade file to current fileformat.
2324

2425
----------------------------------------------
2526

src/realm/exec/realm2json.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,17 +118,17 @@ int main(int argc, char const* argv[])
118118
print(db->start_read());
119119
return 0;
120120
}
121-
catch (const realm::FileFormatUpgradeRequired&) {
122-
options.allow_file_format_upgrade = true;
123-
options.is_immutable = false;
124-
}
125121
catch (const realm::IncompatibleHistories&) {
126122
hist = realm::sync::make_client_replication();
127123
options.allow_file_format_upgrade = false;
128124
options.is_immutable = true;
129125
}
130-
catch (...) {
131-
break;
126+
catch (const realm::FileAccessError& e) {
127+
if (e.code() != realm::ErrorCodes::FileFormatUpgradeRequired) {
128+
throw;
129+
}
130+
options.allow_file_format_upgrade = true;
131+
options.is_immutable = false;
132132
}
133133
}
134134

0 commit comments

Comments
 (0)