Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Douglas
jio
Commits
775ea587
Commit
775ea587
authored
Mar 10, 2014
by
Marco Mariani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
while matching, ignore exceptions thrown by cast_to constructors
parent
30ce96a4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
4 deletions
+39
-4
jio.js
jio.js
+11
-2
src/queries/core/simplequery.js
src/queries/core/simplequery.js
+11
-2
test/queries/key.tests.js
test/queries/key.tests.js
+17
-0
No files found.
jio.js
View file @
775ea587
...
...
@@ -4773,8 +4773,17 @@ SimpleQuery.prototype.match = function (item) {
cast_to
=
this
.
_key_schema
.
cast_lookup
[
cast_to
];
}
value
=
cast_to
(
value
);
object_value
=
cast_to
(
object_value
);
try
{
value
=
cast_to
(
value
);
}
catch
(
e
)
{
value
=
undefined
;
}
try
{
object_value
=
cast_to
(
object_value
);
}
catch
(
e
)
{
object_value
=
undefined
;
}
}
}
else
{
object_value
=
item
[
key
];
...
...
src/queries/core/simplequery.js
View file @
775ea587
...
...
@@ -159,8 +159,17 @@ SimpleQuery.prototype.match = function (item) {
cast_to
=
this
.
_key_schema
.
cast_lookup
[
cast_to
];
}
value
=
cast_to
(
value
);
object_value
=
cast_to
(
object_value
);
try
{
value
=
cast_to
(
value
);
}
catch
(
e
)
{
value
=
undefined
;
}
try
{
object_value
=
cast_to
(
object_value
);
}
catch
(
e
)
{
object_value
=
undefined
;
}
}
}
else
{
object_value
=
item
[
key
];
...
...
test/queries/key.tests.js
View file @
775ea587
...
...
@@ -130,6 +130,10 @@
read_from
:
'
date
'
,
cast_to
:
dateCast
,
equal_match
:
sameYear
},
broken
:
{
read_from
:
'
date
'
,
cast_to
:
function
()
{
throw
new
Error
(
'
Broken!
'
);
}
}
};
...
...
@@ -178,6 +182,19 @@
})
);
promise
.
push
(
jIO
.
QueryFactory
.
create
({
type
:
'
simple
'
,
key
:
keys
.
broken
,
value
:
'
2013-02-10
'
}).
exec
(
docList
()).
then
(
function
(
dl
)
{
deepEqual
(
dl
.
length
,
0
,
'
Constructors that throw exceptions should not break a query, but silently fail comparisons
'
);
})
);
RSVP
.
all
(
promise
).
then
(
noop
).
always
(
start
);
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment