Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
ruby-liudesk-cmdb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LiU IT - Infrastructure
ruby-liudesk-cmdb
Commits
0ef2fb5f
Verified
Commit
0ef2fb5f
authored
1 year ago
by
Alexander Olofsson
Browse files
Options
Downloads
Patches
Plain Diff
Return correct error data for 500 responses
parent
13a86c78
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Pipeline
#104362
passed
1 year ago
Stage: test
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/liudesk_cmdb.rb
+2
-0
2 additions, 0 deletions
lib/liudesk_cmdb.rb
lib/liudesk_cmdb/client.rb
+4
-4
4 additions, 4 deletions
lib/liudesk_cmdb/client.rb
with
6 additions
and
4 deletions
lib/liudesk_cmdb.rb
+
2
−
0
View file @
0ef2fb5f
...
@@ -41,6 +41,8 @@ module LiudeskCMDB
...
@@ -41,6 +41,8 @@ module LiudeskCMDB
NotAcceptableError
.
new
body
,
code
NotAcceptableError
.
new
body
,
code
when
"422"
when
"422"
UnprocessableError
.
new
body
,
code
UnprocessableError
.
new
body
,
code
when
"500"
ServerError
.
new
body
,
code
else
else
RequestError
.
new
body
,
code
RequestError
.
new
body
,
code
end
end
...
...
This diff is collapsed.
Click to expand it.
lib/liudesk_cmdb/client.rb
+
4
−
4
View file @
0ef2fb5f
...
@@ -80,14 +80,14 @@ module LiudeskCMDB
...
@@ -80,14 +80,14 @@ module LiudeskCMDB
response
.
body
response
.
body
rescue
Net
::
HTTPClientException
,
Net
::
HTTPFatalError
rescue
Net
::
HTTPClientException
,
Net
::
HTTPFatalError
begin
begin
body
=
JSON
.
parse
(
response
.
body
)
unless
response
.
body
.
empty?
resp
=
JSON
.
parse
(
response
.
body
)
unless
response
.
body
.
empty?
rescue
StandardError
=>
e
rescue
StandardError
=>
e
logger
.
debug
"Failed to parse error response -
#{
e
.
class
}
:
#{
e
}
"
logger
.
debug
"Failed to parse error response -
#{
e
.
class
}
:
#{
e
}
"
body
=
response
.
body
resp
=
response
.
body
body
=
response
.
message
if
body
.
nil?
||
body
.
empty?
resp
=
response
.
message
if
resp
.
nil?
||
resp
.
empty?
end
end
raise
LiudeskCMDB
::
RequestError
.
create
(
body
,
response
.
code
)
raise
LiudeskCMDB
::
RequestError
.
create
(
resp
,
response
.
code
)
end
end
def
pretty_print_instance_variables
def
pretty_print_instance_variables
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment