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

Realm JS bubbles messages with "binary" type that is unknown to the developer

    • Type: Icon: Task Task
    • Resolution: Unresolved
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: None

      Goals

      When I forget that a data field is required and try to write null to it, I want the error message to mention the 'data' type.

      Expected Results

      Expecting an error with the following message:

      > RequiredTypes.dataRequired must be of type 'data', got 'null' (null)

      Actual Results

      I'm getting an error with the following message:

      > RequiredTypes.dataRequired must be of type 'binary', got 'null' (null)

      Or actually - I would love if "data" was called "binary" as it's so hard to tell apart from "dat*e*".

      Steps to Reproduce

      1. Create a realm with a schema that has a required "data" property.
      2. Try to write a null to an object in that field.

      Code Sample

      const Realm = require('realm');
      const realm = new Realm({
        schema: [
          { name: 'TestClass', properties: { requiredData: 'data' } }
        ],
        path: 'required-data.realm',
      });
      realm.write(() => {
        realm.create('TestClass', { requiredData: null });
      });
      

      Version of Realm and Tooling

      • Realm JS SDK Version: 2.0.4
      • Node or React Native: Node
      • Client OS & Version: Mac
      • Which debugger for React Native: None

            Assignee:
            Unassigned Unassigned
            Reporter:
            kraen.hansen@mongodb.com Kræn Hansen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: