Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
preetwinder
jio
Commits
f20bd74c
Commit
f20bd74c
authored
12 years ago
by
Tristan Cavelier
Browse files
Options
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
;
};
...
...
This diff is collapsed.
Click to expand it.
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