From dfa64f3c3d027b644d0b94617ad07d96f2ed294c Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Thu, 11 Aug 2022 13:15:57 -0500 Subject: [PATCH] Added color to errors --- file/error.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/file/error.go b/file/error.go index 6a0d502..64d60f9 100644 --- a/file/error.go +++ b/file/error.go @@ -38,9 +38,9 @@ func NewError ( func (err Error) Error () (formattedMessage string) { switch err.kind { case ErrorKindError: - formattedMessage += "ERR" + formattedMessage += "\033[31mERR\033[0m" case ErrorKindWarn: - formattedMessage += "!!!" + formattedMessage += "\033[33m!!!\033[0m" } // print information about the location of the mistake @@ -49,7 +49,9 @@ func (err Error) Error () (formattedMessage string) { " ", err.Location.row + 1, ":", err.Location.column + 1) } - formattedMessage += " in " + err.Location.file.path + "\n" + formattedMessage += + " \033[90min\033[0m " + + err.Location.file.path + "\n" if err.width > 0 { // print erroneous line