Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
packer
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kristopher Ruzic
packer
Commits
6eb0568f
Commit
6eb0568f
authored
Jun 17, 2013
by
Jack Pearkes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
builder/digitalocean: print bad status code as string
parent
341cfb2c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
6 deletions
+4
-6
builder/digitalocean/api.go
builder/digitalocean/api.go
+4
-6
No files found.
builder/digitalocean/api.go
View file @
6eb0568f
...
...
@@ -154,15 +154,14 @@ func NewRequest(d DigitalOceanClient, path string, params string) (map[string]in
err
=
json
.
Unmarshal
(
body
,
&
decodedResponse
)
log
.
Printf
(
"response from digitalocean: %v"
,
decodedResponse
)
// Catch all non-200 status and return an error
if
resp
.
StatusCode
!=
200
{
err
=
errors
.
New
(
fmt
.
Sprintf
(
"Recieved non-200 HTTP status from DigitalOcean: %d"
,
resp
.
StatusCode
))
log
.
Printf
(
"response from digital ocean: %v"
,
decodedResponse
)
err
=
errors
.
New
(
fmt
.
Sprintf
(
"Received non-200 HTTP status from DigitalOcean: %v"
,
resp
.
StatusCode
))
return
decodedResponse
,
err
}
log
.
Printf
(
"response from digital ocean: %v"
,
decodedResponse
)
if
err
!=
nil
{
return
decodedResponse
,
err
}
...
...
@@ -174,8 +173,7 @@ func NewRequest(d DigitalOceanClient, path string, params string) (map[string]in
if
status
==
"ERROR"
{
status
=
decodedResponse
[
"error_message"
]
}
err
=
errors
.
New
(
fmt
.
Sprintf
(
"Recieved bad status from DigitalOcean: %v"
,
status
))
log
.
Printf
(
"response from digital ocean: %v"
,
decodedResponse
)
err
=
errors
.
New
(
fmt
.
Sprintf
(
"Received bad status from DigitalOcean: %v"
,
status
))
return
decodedResponse
,
err
}
...
...
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