Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
cd0aed3d
Commit
cd0aed3d
authored
Jan 07, 2015
by
Marin Jankovski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a message when unable to save an object through api.
parent
0da5154b
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
15 additions
and
15 deletions
+15
-15
lib/api/commits.rb
lib/api/commits.rb
+1
-1
lib/api/deploy_keys.rb
lib/api/deploy_keys.rb
+1
-1
lib/api/groups.rb
lib/api/groups.rb
+2
-2
lib/api/issues.rb
lib/api/issues.rb
+4
-4
lib/api/labels.rb
lib/api/labels.rb
+2
-2
lib/api/merge_requests.rb
lib/api/merge_requests.rb
+2
-2
lib/api/milestones.rb
lib/api/milestones.rb
+2
-2
lib/api/notes.rb
lib/api/notes.rb
+1
-1
No files found.
lib/api/commits.rb
View file @
cd0aed3d
...
...
@@ -108,7 +108,7 @@ module API
if
note
.
save
present
note
,
with:
Entities
::
CommitNote
else
render_api_error!
(
"Failed to save note
#{
note
.
errors
.
messages
}
"
,
4
22
)
render_api_error!
(
"Failed to save note
#{
note
.
errors
.
messages
}
"
,
4
00
)
end
end
end
...
...
lib/api/deploy_keys.rb
View file @
cd0aed3d
...
...
@@ -58,7 +58,7 @@ module API
if
key
.
valid?
&&
user_project
.
deploy_keys
<<
key
present
key
,
with:
Entities
::
SSHKey
else
render_
validation_error!
(
key
)
render_
api_error!
(
"Failed to add key
#{
key
.
errors
.
messages
}
"
,
400
)
end
end
...
...
lib/api/groups.rb
View file @
cd0aed3d
...
...
@@ -54,7 +54,7 @@ module API
if
@group
.
save
present
@group
,
with:
Entities
::
Group
else
render_api_error!
(
"Failed to save group
#{
@group
.
errors
.
messages
}
"
,
4
22
)
render_api_error!
(
"Failed to save group
#{
@group
.
errors
.
messages
}
"
,
4
00
)
end
end
...
...
@@ -97,7 +97,7 @@ module API
if
result
present
group
else
render_api_error!
(
"Failed to transfer project
#{
project
.
errors
.
messages
}
"
,
4
22
)
render_api_error!
(
"Failed to transfer project
#{
project
.
errors
.
messages
}
"
,
4
00
)
end
end
end
...
...
lib/api/issues.rb
View file @
cd0aed3d
...
...
@@ -104,7 +104,7 @@ module API
# Validate label names in advance
if
(
errors
=
validate_label_params
(
params
)).
any?
render_api_error!
(
{
labels:
errors
},
400
)
render_api_error!
(
"Unable to validate label:
#{
errors
}
"
},
400
)
end
issue
=
::
Issues
::
CreateService
.
new
(
user_project
,
current_user
,
attrs
).
execute
...
...
@@ -118,7 +118,7 @@ module API
present
issue
,
with:
Entities
::
Issue
else
render_
validation_error!
(
issue
)
render_
api_error!
(
"Unable to create issue
#{
issue
.
errors
.
messages
}
"
,
400
)
end
end
...
...
@@ -142,7 +142,7 @@ module API
# Validate label names in advance
if
(
errors
=
validate_label_params
(
params
)).
any?
render_api_error!
(
{
labels:
errors
},
400
)
render_api_error!
(
"Unable to validate label:
#{
errors
}
"
},
400
)
end
issue
=
::
Issues
::
UpdateService
.
new
(
user_project
,
current_user
,
attrs
).
execute
(
issue
)
...
...
@@ -158,7 +158,7 @@ module API
present
issue
,
with:
Entities
::
Issue
else
render_
validation_error!
(
issue
)
render_
api_error!
(
"Unable to update issue
#{
issue
.
errors
.
messages
}
"
,
400
)
end
end
...
...
lib/api/labels.rb
View file @
cd0aed3d
...
...
@@ -37,7 +37,7 @@ module API
if
label
.
valid?
present
label
,
with:
Entities
::
Label
else
render_
validation_error!
(
label
)
render_
api_error!
(
"Unable to create label
#{
label
.
errors
.
messages
}
"
,
400
)
end
end
...
...
@@ -90,7 +90,7 @@ module API
if
label
.
update
(
attrs
)
present
label
,
with:
Entities
::
Label
else
render_
validation_error!
(
label
)
render_
api_error!
(
"Unable to create label
#{
label
.
errors
.
messages
}
"
,
400
)
end
end
end
...
...
lib/api/merge_requests.rb
View file @
cd0aed3d
...
...
@@ -137,7 +137,7 @@ module API
# Validate label names in advance
if
(
errors
=
validate_label_params
(
params
)).
any?
render_api_error!
(
{
labels:
errors
},
400
)
render_api_error!
(
"Unable to validate label:
#{
errors
}
"
},
400
)
end
merge_request
=
::
MergeRequests
::
UpdateService
.
new
(
user_project
,
current_user
,
attrs
).
execute
(
merge_request
)
...
...
@@ -233,7 +233,7 @@ module API
if
note
.
save
present
note
,
with:
Entities
::
MRNote
else
render_
validation_error!
(
note
)
render_
api_error!
(
"Failed to save note
#{
note
.
errors
.
messages
}
"
,
400
)
end
end
end
...
...
lib/api/milestones.rb
View file @
cd0aed3d
...
...
@@ -48,7 +48,7 @@ module API
if
milestone
.
valid?
present
milestone
,
with:
Entities
::
Milestone
else
not_found!
(
"Milestone
#{
milestone
.
errors
.
messages
}
"
)
render_api_error!
(
"Failed to create milestone
#{
milestone
.
errors
.
messages
}
"
,
400
)
end
end
...
...
@@ -72,7 +72,7 @@ module API
if
milestone
.
valid?
present
milestone
,
with:
Entities
::
Milestone
else
not_found!
(
"Milestone
#{
milestone
.
errors
.
messages
}
"
)
render_api_error!
(
"Failed to update milestone
#{
milestone
.
errors
.
messages
}
"
,
400
)
end
end
end
...
...
lib/api/notes.rb
View file @
cd0aed3d
...
...
@@ -93,7 +93,7 @@ module API
if
@note
.
valid?
present
@note
,
with:
Entities
::
Note
else
bad_request!
(
'Invalid note'
)
render_api_error!
(
"Failed to save note
#{
note
.
errors
.
messages
}
"
,
400
)
end
end
...
...
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