From b15b5b7be14ad336ac3601bbe2970ce1da1497f6 Mon Sep 17 00:00:00 2001 From: Noah Date: Mon, 15 Apr 2024 15:33:26 -0500 Subject: [PATCH] Add DeployError.ToString() (fix #43) --- deploy_error.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/deploy_error.go b/deploy_error.go index 5523859..7916e78 100644 --- a/deploy_error.go +++ b/deploy_error.go @@ -15,9 +15,13 @@ type DeployError struct { // SendOverMatrix provides an easy way to send the contents of a DeployError over Matrix func (deploy_error *DeployError) SendOverMatrix() { - sendMessage(MatrixMessage{text: fmt.Sprintf("%s**Error in **`%s`**!**\n- *%s*\n- Code: %d", - Circles["red"], deploy_error.where, deploy_error.details, deploy_error.code), - }) + 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