-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #499 from kool-dev/deploy-build-error
Report to API in case of error building deploy images
- Loading branch information
Showing
3 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package api | ||
|
||
import "fmt" | ||
|
||
// DeployError consumes the API endpoint to inform a build error for a deployment | ||
type DeployError struct { | ||
Endpoint | ||
} | ||
|
||
// NewDeployError creates a new DeployError instance | ||
func NewDeployError(created *DeployCreateResponse, err error) (c *DeployError) { | ||
c = &DeployError{ | ||
Endpoint: NewDefaultEndpoint("POST"), | ||
} | ||
|
||
c.SetPath("deploy/error") | ||
c.Body().Set("id", fmt.Sprintf("%d", created.Deploy.ID)) | ||
c.Body().Set("err", err.Error()) | ||
|
||
return | ||
} | ||
|
||
// Run calls deploy/error in the Kool Dev API | ||
func (c *DeployError) Run() (err error) { | ||
var resp interface{} | ||
c.SetResponseReceiver(&resp) | ||
err = c.DoCall() | ||
return | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters