Uploaded image for project: 'Realm JavaScript SDK'
  1. Realm JavaScript SDK
  2. RJS-215

Realm.open throws instead of rejecting the Promise on unexpected schema change.

      Goals

      I noticed that calling Realm.open with a previously created DB after changing fields in the schema (without changing the schema version, and therefore not triggering migrations) results in throwing an error, instead of rejecting the promise.

      Expected Results

      I would have expected the promise to be rejected.

      Actual Results

      An error is thrown.

      Steps to Reproduce

      1. Call Realm.open with an existing schema.
      2. Change the schema, add a filed to a model, but don't bump the schema version.
      3. Call Realm.open with the new schema on the same db. Make sure to implement .catch on the returned promise.

      Observe an error being thrown, instead of .catch being invoked.

      Code Sample

      Clone https://github.com/stigi/just-a-realm-js-issue.
      yarn && yarn demo

      Code sample as a gist in case I decide to clean up the repo eventually: https://gist.github.com/stigi/d0117b2c054fa48a960e3de538e5eac7

      Version of Realm and Tooling

      • Realm JS SDK Version: 2.2.10
      • Node or React Native: Both. Code Sample on Node version 9.5.0
      • Client OS & Version: Darwin flatbread.local 17.4.0 Darwin Kernel Version 17.4.0: Sun Dec 17 09:19:54 PST 2017; root:xnu-4570.41.2~1/RELEASE_X86_64 x86_64
      • Which debugger for React Native: None

            Assignee:
            Unassigned Unassigned
            Reporter:
            unitosyncbot Unito Sync Bot
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: