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
Cédric Le Ninivin
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
Hide 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) {
/**
* Creates the error object for all errors
* @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 {object} error_object The error object (optional)
* @return {object} Error object
*/
that
.
createErrorObject
=
function
(
error_code
,
message
)
{
var
error_object
,
assignErrorValues
;
error_object
=
{
"
status
"
:
error_code
,
"
message
"
:
message
,
"
reason
"
:
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
;
}
that
.
createErrorObject
=
function
(
error_code
,
error_name
,
message
,
error_object
)
{
error_object
=
error_object
||
{};
error_okject
[
"
status
"
]
=
error_code
||
0
;
error_object
[
"
statusText
"
]
=
error_name
;
error_object
[
"
error
"
]
=
error_name
.
toLowerCase
().
split
(
'
'
).
join
(
'
_
'
);
error_object
[
"
message
"
]
=
error_object
[
"
error
"
]
=
message
;
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