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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
b6a256a4
Commit
b6a256a4
authored
Sep 11, 2019
by
Rubén Dávila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve consistency when handling error messages
parent
28fe92a1
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
+6
-4
ee/app/services/gitlab_subscriptions/create_lead_service.rb
ee/app/services/gitlab_subscriptions/create_lead_service.rb
+1
-1
ee/lib/gitlab/subscription_portal/client.rb
ee/lib/gitlab/subscription_portal/client.rb
+5
-3
No files found.
ee/app/services/gitlab_subscriptions/create_lead_service.rb
View file @
b6a256a4
...
...
@@ -8,7 +8,7 @@ module GitlabSubscriptions
if
response
[
:success
]
{
success:
true
}
else
{
success:
false
,
errors:
response
.
dig
(
:data
,
'errors'
)
}
{
success:
false
,
errors:
response
.
dig
(
:data
,
:errors
)
}
end
end
...
...
ee/lib/gitlab/subscription_portal/client.rb
View file @
b6a256a4
...
...
@@ -27,13 +27,15 @@ module Gitlab
end
def
parse_response
(
http_response
)
parsed_response
=
http_response
.
parsed_response
case
http_response
.
response
when
Net
::
HTTPSuccess
{
success:
true
,
data:
http_response
.
parsed_response
}
{
success:
true
,
data:
parsed_response
}
when
Net
::
HTTPUnprocessableEntity
{
success:
false
,
data:
http_response
.
parsed_response
}
{
success:
false
,
data:
{
errors:
parsed_response
[
'errors'
]
}
}
else
{
success:
false
,
data:
"HTTP status code:
#{
http_response
.
code
}
"
}
{
success:
false
,
data:
{
errors:
"HTTP status code:
#{
http_response
.
code
}
"
}
}
end
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