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
Labels
Merge Requests
18
Merge Requests
18
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
jio
Commits
f20bd74c
Commit
f20bd74c
authored
Dec 21, 2012
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
createErrorObject Modified
parent
7ea4a355
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
28 deletions
+10
-28
src/jio/storages/storage.js
src/jio/storages/storage.js
+10
-28
No files found.
src/jio/storages/storage.js
View file @
f20bd74c
...
@@ -17,37 +17,19 @@ var storage = function(spec, my) {
...
@@ -17,37 +17,19 @@ var storage = function(spec, my) {
/**
/**
* Creates the error object for all errors
* Creates the error object for all errors
* @method createErrorObject
* @method createErrorObject
* @param {string} error_code The error code
* @param {number} error_code The error code
* @param {string} error_name The error name
* @param {string} message The error message
* @param {string} message The error message
* @param {object} error_object The error object (optional)
* @return {object} Error object
* @return {object} Error object
*/
*/
that
.
createErrorObject
=
function
(
error_code
,
message
)
{
that
.
createErrorObject
=
function
(
error_code
,
error_name
,
var
error_object
,
assignErrorValues
;
message
,
error_object
)
{
error_object
=
error_object
||
{};
error_object
=
{
error_okject
[
"
status
"
]
=
error_code
||
0
;
"
status
"
:
error_code
,
error_object
[
"
statusText
"
]
=
error_name
;
"
message
"
:
message
,
error_object
[
"
error
"
]
=
error_name
.
toLowerCase
().
split
(
'
'
).
join
(
'
_
'
);
"
reason
"
:
message
error_object
[
"
message
"
]
=
error_object
[
"
error
"
]
=
message
;
};
assignErrorValues
=
function
(
statusText
)
{
var
tmp
=
''
;
error_object
.
statusText
=
statusText
;
error_object
.
error
=
statusText
.
toLowerCase
().
split
(
'
'
).
join
(
'
_
'
);
};
switch
(
code
)
{
case
409
:
assignErrorValues
(
'
Conflict
'
);
break
;
case
403
:
assignErrorValues
(
'
Forbidden
'
);
break
;
case
404
:
assignErrorValues
(
'
Not found
'
);
break
;
}
return
error_object
;
return
error_object
;
};
};
...
...
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