Add DeployError.ToString() (fix #43)

This commit is contained in:
Noah 2024-04-15 15:33:26 -05:00
parent e855c3e630
commit b15b5b7be1

View File

@ -15,9 +15,13 @@ type DeployError struct {
// SendOverMatrix provides an easy way to send the contents of a DeployError over Matrix // SendOverMatrix provides an easy way to send the contents of a DeployError over Matrix
func (deploy_error *DeployError) SendOverMatrix() { func (deploy_error *DeployError) SendOverMatrix() {
sendMessage(MatrixMessage{text: fmt.Sprintf("%s**Error in **`%s`**!**\n- *%s*\n- Code: %d", sendMessage(MatrixMessage{text: deploy_error.ToString()})
Circles["red"], deploy_error.where, deploy_error.details, deploy_error.code), }
})
// 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 // newDeployError creates a DeployError