-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
Currently the exception reported by the driver when trying to connect to a v1 database is a SQLException with the following properties:
- Text:
General error: "The write format 1 is smaller than the supported format 2 [2.1.210/5]" [50000-210] - SQLState: HY000
- vendorCode: 50000, equal to
org.h2.api.ErrorCode.GENERAL_ERROR_1 - cause: MVStoreException with errorCode: 5, equal to
org.h2.mvstore.DataUtils.ERROR_UNSUPPORTED_FORMAT.
Thus, the only way to discern that the reason for the exception is that the file uses an old format is by checking that there is a causing MVStoreException inside the SQLException, casting it and checking its error code. Given that MVStoreException and DataUtils are both outside the main or "api" packages, this method feels like it could fail in the very next version.
Instead, the vendorCode of this particular exception could be a specific value in the "fully public" ErrorCode class. There seems to be a FILE_VERSION_ERROR_1 member already (with value 90048) that could be reused, or if that is unwise because it is supposed to represent something else, a new value could be created.
Note: I only mention MVStore because that's what I use; I don't know if PageStore suffers from the same problem. I see that PageStore was removed from 2.0