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
Vincent Bechu
jio
Commits
982efe39
Commit
982efe39
authored
Dec 24, 2012
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Error thrown by subCommands.js are improved
parent
192c14a1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
74 additions
and
8 deletions
+74
-8
src/jio/commands/getCommand.js
src/jio/commands/getCommand.js
+18
-4
src/jio/commands/postCommand.js
src/jio/commands/postCommand.js
+15
-0
src/jio/commands/putAttachmentCommand.js
src/jio/commands/putAttachmentCommand.js
+16
-4
src/jio/commands/putCommand.js
src/jio/commands/putCommand.js
+25
-0
No files found.
src/jio/commands/getCommand.js
View file @
982efe39
...
...
@@ -9,14 +9,28 @@ var getCommand = function(spec, my) {
};
that
.
validateState
=
function
()
{
if
(
!
that
.
getDocId
()
)
{
if
(
typeof
that
.
getDocId
()
===
"
string
"
&&
that
.
getDocId
()
===
""
)
{
that
.
error
({
status
:
20
,
statusText
:
'
Document Id Required
'
,
error
:
'
document_id_required
'
,
message
:
'
No document id.
'
,
reason
:
'
no document id
'
"
status
"
:
20
,
"
statusText
"
:
"
Document Id Required
"
,
"
error
"
:
"
document_id_required
"
,
"
message
"
:
"
The document id is not provided
"
,
"
reason
"
:
"
Document id is undefined
"
});
return
false
;
}
if
(
typeof
that
.
getAttachmentId
()
===
"
string
"
)
{
if
(
that
.
getAttachmentId
()
===
""
)
{
that
.
error
({
"
status
"
:
23
,
"
statusText
"
:
"
Invalid Attachment Id
"
,
"
error
"
:
"
invalid_attachment_id
"
,
"
message
"
:
"
The attachment id must not be an empty string
"
,
"
reason
"
:
"
Attachment id is empty
"
});
}
return
false
;
}
return
true
;
};
...
...
src/jio/commands/postCommand.js
View file @
982efe39
...
...
@@ -10,6 +10,21 @@ var postCommand = function(spec, my) {
return
'
post
'
;
};
that
.
validateState
=
function
()
{
if
(
typeof
that
.
getAttachmentId
()
!==
"
undefined
"
)
{
that
.
error
({
"
status
"
:
21
,
"
statusText
"
:
"
Invalid Document Id
"
,
"
error
"
:
"
Invalid Document Id
"
,
"
message
"
:
"
The document id contains '/' characters
"
+
"
which are forbidden
"
,
"
reason
"
:
"
Document id contains '/' character(s)
"
});
return
false
;
}
return
true
;
};
that
.
executeOn
=
function
(
storage
)
{
storage
.
post
(
that
);
};
...
...
src/jio/commands/putAttachmentCommand.js
View file @
982efe39
...
...
@@ -11,15 +11,27 @@ var putAttachmentCommand = function(spec, my) {
that
.
executeOn
=
function
(
storage
)
{
storage
.
putAttachment
(
that
);
};
that
.
validateState
=
function
()
{
if
(
typeof
that
.
get
Content
()
!==
'
string
'
)
{
if
(
typeof
that
.
get
AttachmentId
()
===
"
undefined
"
)
{
that
.
error
({
status
:
22
,
statusText
:
'
Content Required
'
,
error
:
'
content_required
'
,
message
:
'
No data to put.
'
,
reason
:
'
no data to put
'
"
status
"
:
22
,
"
statusText
"
:
"
Attachment Id Required
"
,
"
error
"
:
"
attachment_id_required
"
,
"
message
"
:
"
The attachment id must be set
"
,
"
reason
"
:
"
Attachment id not set
"
});
return
false
;
}
if
(
that
.
getAttachmentId
()
===
""
)
{
that
.
error
({
"
status
"
:
23
,
"
statusText
"
:
"
Invalid Attachment Id
"
,
"
error
"
:
"
invalid_attachment_id
"
,
"
message
"
:
"
The attachment id must not be an empty string
"
,
"
reason
"
:
"
Attachment id is empty
"
});
}
return
true
;
};
...
...
src/jio/commands/putCommand.js
View file @
982efe39
...
...
@@ -10,6 +10,31 @@ var putCommand = function(spec, my) {
return
'
put
'
;
};
that
.
validateState
=
function
()
{
if
(
typeof
that
.
getDocId
()
===
"
string
"
&&
that
.
getDocId
()
===
""
)
{
that
.
error
({
"
status
"
:
20
,
"
statusText
"
:
"
Document Id Required
"
,
"
error
"
:
"
document_id_required
"
,
"
message
"
:
"
The document id is not provided
"
,
"
reason
"
:
"
Document id is undefined
"
});
return
false
;
}
if
(
typeof
that
.
getAttachmentId
()
!==
"
undefined
"
)
{
that
.
error
({
"
status
"
:
21
,
"
statusText
"
:
"
Invalid Document Id
"
,
"
error
"
:
"
invalid_document_id
"
,
"
message
"
:
"
The document id contains '/' characters
"
+
"
which are forbidden
"
,
"
reason
"
:
"
Document id contains '/' character(s)
"
});
return
false
;
}
return
true
;
};
that
.
executeOn
=
function
(
storage
)
{
storage
.
put
(
that
);
};
...
...
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