Forgetting placeholder value should throw a meaningful error
See original GitHub issueGoals
Getting a better error message if I forget to define the value for a placeholder, when querying a Realm.
Expected Results
I would love a message that said: “Query uses the $0 placeholder but a value was not provided”.
Actual Results
An error is thrown with "vector"
as message
.
Steps to Reproduce
Define a schema
const schema: Realm.ObjectSchema[] = [{
name: 'Person',
properties: {
name: 'string',
age: 'int',
}
}];
Query data
realm.objects('Person').filtered('name != $0');
🔥
Code Sample
import * as assert from 'assert';
import * as Realm from 'realm';
const schema: Realm.ObjectSchema[] = [
{
name: 'Person',
properties: {
name: 'string',
age: 'int',
}
}
];
describe('Realm filtering with an undefined placeholder', () => {
let realm: Realm;
before(() => {
// Open a local realm
assert(!realm);
realm = new Realm({ path: 'test.realm', schema });
});
after(() => {
if (realm) {
if (!realm.isClosed) {
realm.close();
}
Realm.deleteFile({ path: realm.path });
}
});
it('throws a meaningful message', (done) => {
// First we create a collection
const persons = realm.objects('Person');
assert.equal(persons.length, 0);
try {
const filteredPersons = persons.filtered('age > $0');
} catch (err) {
assert.notEqual(err.message, 'vector');
}
});
});
Version of Realm and Tooling
- Realm JS SDK Version: 2.6.0
- Node or React Native: N/A
- Client OS & Version: N/A
- Which debugger for React Native: N/A
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Spring Could not Resolve placeholder - Stack Overflow
In my case , I forgot to add the new property in my application.properties under test folder.Adding it resolved the issue.
Read more >Why Using Input Placeholders in Place of Labels is a Bad Idea
When the placeholder attribute made its way into HTML5 and became commonplace, a bad trend started—using them in place of labels for form ......
Read more >Don't Use The Placeholder Attribute - Smashing Magazine
When a person enters information into an input, its placeholder content will disappear. The only way to restore it is to remove the...
Read more >Power Query M Primer (Part 15): Error Handling | Ben Gribaudo
When an access attempt occurs, the logic that originally caused the error is not re-evaluated to see if it now will produce a...
Read more >Error thrown - Warning: You called act(async () => ...) without ...
Ask your Question. I have a simple test that seems to generate the right snapshot at the end of execution, but throws me...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
2.8.3 has been released.
The fix is included in core 5.6.1.