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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Romain Courteaud
jio
Commits
cb2eaea6
Commit
cb2eaea6
authored
Jun 29, 2017
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IndexedDB: provide some informations in the error message
parent
a0c3917a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
10 deletions
+23
-10
src/jio.storage/indexeddbstorage.js
src/jio.storage/indexeddbstorage.js
+15
-8
test/jio.storage/indexeddbstorage.tests.js
test/jio.storage/indexeddbstorage.tests.js
+8
-2
No files found.
src/jio.storage/indexeddbstorage.js
View file @
cb2eaea6
...
...
@@ -209,14 +209,18 @@
});
};
function
handleGet
(
request
,
resolve
,
reject
)
{
function
handleGet
(
store
,
id
,
resolve
,
reject
)
{
var
request
=
store
.
get
(
id
);
request
.
onerror
=
reject
;
request
.
onsuccess
=
function
()
{
if
(
request
.
result
)
{
resolve
(
request
.
result
);
}
else
{
// XXX How to get ID
reject
(
new
jIO
.
util
.
jIOError
(
"
Cannot find document
"
,
404
));
reject
(
new
jIO
.
util
.
jIOError
(
"
IndexedDB: cannot find object '
"
+
id
+
"
' in the '
"
+
store
.
name
+
"
' store
"
,
404
));
}
};
}
...
...
@@ -227,7 +231,8 @@
return
new
RSVP
.
Promise
(
function
(
resolve
,
reject
)
{
var
transaction
=
openTransaction
(
db
,
[
"
metadata
"
],
"
readonly
"
);
handleGet
(
transaction
.
objectStore
(
"
metadata
"
).
get
(
id
),
transaction
.
objectStore
(
"
metadata
"
),
id
,
resolve
,
reject
);
...
...
@@ -260,7 +265,8 @@
);
}
handleGet
(
transaction
.
objectStore
(
"
metadata
"
).
get
(
id
),
transaction
.
objectStore
(
"
metadata
"
),
id
,
getAttachments
,
reject
);
...
...
@@ -388,7 +394,8 @@
result_list
.
push
(
result
);
}
i
+=
1
;
handleGet
(
store
.
get
(
buildKeyPath
([
id
,
name
,
i
])),
handleGet
(
store
,
buildKeyPath
([
id
,
name
,
i
]),
(
i
<=
end_index
)
?
getPart
(
i
)
:
resolver
,
reject
);
...
...
@@ -397,8 +404,8 @@
getPart
(
start_index
-
1
)();
}
// XXX Should raise if key is not good
handleGet
(
transaction
.
objectStore
(
"
attachment
"
)
.
get
(
buildKeyPath
([
id
,
name
])
),
handleGet
(
transaction
.
objectStore
(
"
attachment
"
)
,
buildKeyPath
([
id
,
name
]
),
getBlob
,
reject
);
...
...
test/jio.storage/indexeddbstorage.tests.js
View file @
cb2eaea6
...
...
@@ -493,7 +493,10 @@
})
.
fail
(
function
(
error
)
{
ok
(
error
instanceof
jIO
.
util
.
jIOError
);
equal
(
error
.
message
,
"
Cannot find document
"
);
equal
(
error
.
message
,
"
IndexedDB: cannot find object 'inexistent' in the 'metadata' store
"
);
equal
(
error
.
status_code
,
404
);
})
.
fail
(
function
(
error
)
{
...
...
@@ -679,7 +682,10 @@
})
.
fail
(
function
(
error
)
{
ok
(
error
instanceof
jIO
.
util
.
jIOError
);
equal
(
error
.
message
,
"
Cannot find document
"
);
equal
(
error
.
message
,
"
IndexedDB: cannot find object 'inexistent' in the 'metadata' store
"
);
equal
(
error
.
status_code
,
404
);
})
.
fail
(
function
(
error
)
{
...
...
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