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
Eugene Shen
jio
Commits
fbe16407
Commit
fbe16407
authored
Dec 20, 2012
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
throwError replaced by createErrorObject
parent
90d37ed6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
33 deletions
+29
-33
src/jio.storage/intro.js
src/jio.storage/intro.js
+29
-33
No files found.
src/jio.storage/intro.js
View file @
fbe16407
...
@@ -76,44 +76,40 @@ var utilities = {
...
@@ -76,44 +76,40 @@ var utilities = {
},
},
/**
/**
* @method throwError - Creates the error object for all errors
* Creates the error object for all errors
* @param {code} string - the error code.
* @method createErrorObject
* @param {reason} string - the error reason
* @param {string} error_code The error code
* @returns {e} object - error object
* @param {string} message The error message
* @return {object} Error object
*/
*/
throwError
:
function
(
code
,
reason
)
{
createErrorObject
:
function
(
error_code
,
message
)
{
var
statusText
,
error
,
message
,
errorObject
;
var
error_object
,
assignErrorValues
;
switch
(
code
)
{
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
:
case
409
:
statusText
=
'
Conflict
'
;
assignErrorValues
(
'
Conflict
'
);
error
=
'
conflict
'
;
message
=
'
Document update conflict.
'
;
break
;
break
;
case
403
:
case
403
:
statusText
=
'
Forbidden
'
;
assignErrorValues
(
'
Forbidden
'
);
error
=
'
forbidden
'
;
message
=
'
Forbidden
'
;
break
;
break
;
case
404
:
case
404
:
statusText
=
'
Not found
'
;
assignErrorValues
(
'
Not found
'
);
error
=
'
not found
'
;
message
=
'
Document not found.
'
;
break
;
break
;
}
}
// create object
return
error_object
;
errorObject
=
({
status
:
code
,
statusText
:
statusText
,
error
:
error
,
message
:
message
,
reason
:
reason
});
return
errorObject
;
},
},
/**
/**
...
...
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