Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
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
Yaxel Perez
jio
Commits
0fce3ce9
Commit
0fce3ce9
authored
Feb 25, 2014
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5storage.js improve error management
parent
e37bf29c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
29 deletions
+42
-29
src/jio.storage/erp5storage.js
src/jio.storage/erp5storage.js
+42
-29
No files found.
src/jio.storage/erp5storage.js
View file @
0fce3ce9
...
@@ -10,7 +10,8 @@
...
@@ -10,7 +10,8 @@
// }
// }
/*jslint indent: 2, nomen: true, unparam: true */
/*jslint indent: 2, nomen: true, unparam: true */
/*global jIO, complex_queries, console, UriTemplate, FormData, RSVP */
/*global jIO, complex_queries, console, UriTemplate, FormData, RSVP,
ProgressEvent */
(
function
(
jIO
,
complex_queries
)
{
(
function
(
jIO
,
complex_queries
)
{
"
use strict
"
;
"
use strict
"
;
...
@@ -62,14 +63,17 @@
...
@@ -62,14 +63,17 @@
.
then
(
function
(
response
)
{
.
then
(
function
(
response
)
{
command
.
success
({
"
data
"
:
response
});
command
.
success
({
"
data
"
:
response
});
})
})
.
fail
(
function
(
e
rror
)
{
.
fail
(
function
(
e
vent
)
{
console
.
error
(
e
rror
);
console
.
error
(
e
vent
);
// XXX How to propagate the error
if
(
event
instanceof
ProgressEvent
)
{
command
.
error
(
command
.
error
(
"
not_found
"
,
event
.
target
.
status
,
"
missing
"
,
event
.
target
.
statusText
,
"
Cannot find document
"
"
Cannot find document
"
);
);
}
// XXX How to propagate the error
command
.
error
(
event
);
});
});
};
};
...
@@ -115,13 +119,16 @@
...
@@ -115,13 +119,16 @@
"
Cannot find document
"
"
Cannot find document
"
);
);
}
}
},
function
(
error
)
{
},
function
(
event
)
{
console
.
error
(
error
);
console
.
error
(
event
);
command
.
error
(
if
(
event
instanceof
ProgressEvent
)
{
500
,
return
command
.
error
(
"
Too bad...
"
,
event
.
target
.
status
,
event
.
target
.
statusText
,
"
Unable to post doc
"
"
Unable to post doc
"
);
);
}
command
.
error
(
event
);
});
});
};
};
...
@@ -158,13 +165,16 @@
...
@@ -158,13 +165,16 @@
.
then
(
function
(
result
)
{
.
then
(
function
(
result
)
{
command
.
success
(
result
);
command
.
success
(
result
);
})
})
.
fail
(
function
(
error
)
{
.
fail
(
function
(
event
)
{
console
.
error
(
error
);
console
.
error
(
event
);
command
.
error
(
if
(
event
instanceof
ProgressEvent
)
{
"
error
"
,
return
command
.
error
(
"
did not work as expected
"
,
event
.
target
.
status
,
event
.
target
.
statusText
,
"
Unable to call put
"
"
Unable to call put
"
);
);
}
command
.
error
(
event
);
});
});
};
};
...
@@ -223,13 +233,16 @@
...
@@ -223,13 +233,16 @@
count
=
result
.
length
;
count
=
result
.
length
;
command
.
success
({
"
data
"
:
{
"
rows
"
:
result
,
"
total_rows
"
:
count
}});
command
.
success
({
"
data
"
:
{
"
rows
"
:
result
,
"
total_rows
"
:
count
}});
})
})
.
fail
(
function
(
error
)
{
.
fail
(
function
(
event
)
{
console
.
error
(
error
);
console
.
error
(
event
);
command
.
error
(
if
(
event
instanceof
ProgressEvent
)
{
"
error
"
,
return
command
.
error
(
"
did not work as expected
"
,
event
.
target
.
status
,
"
Unable to call allDocs
"
event
.
target
.
statusText
,
"
Cannot get list of document
"
);
);
}
command
.
error
(
event
);
});
});
};
};
...
...
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