// package main is the main package for the LapisDeploy program package main import ( "fmt" ) // DeployError contains important information about an error if something went wrong. type DeployError struct { code int where string details string command_output string } // SendOverMatrix provides an easy way to send the contents of a DeployError over Matrix func (deploy_error *DeployError) SendOverMatrix() { sendMessage(MatrixMessage{text: deploy_error.ToString()}) } // ToString converts a DeployError into a human readable string. func (deploy_error *DeployError) ToString() string { return fmt.Sprintf("%sError in `%s`! (%s) Code: %d", Circles["red"], deploy_error.where, deploy_error.details, deploy_error.code) } // newDeployError creates a DeployError func newDeployError(code int, where string, details string, command_output string) DeployError { return DeployError{code: code, where: where, details: details, command_output: command_output} }