From 98dec9f35991ebc647b71cd49b3f0d70c4c02077 Mon Sep 17 00:00:00 2001 From: odinkh <odinkh@stud.ntnu.no> Date: Thu, 19 May 2022 18:03:23 +0200 Subject: [PATCH] Stops the program from breaking if the URL or Domain does not exist --- utils/screenShot.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/utils/screenShot.go b/utils/screenShot.go index 1793c08..3c54bc9 100644 --- a/utils/screenShot.go +++ b/utils/screenShot.go @@ -2,9 +2,10 @@ package utils import ( "context" + "fmt" "log" "strings" - + logging "dcsg2900-threattotal/logs" "github.com/chromedp/chromedp" ) @@ -35,7 +36,8 @@ func ScreenshotURL(url string, Response *ResultFrontendResponse) { // Take the screenshot using the screenScreenshot function if err := chromedp.Run(ctx, screenScreenshot(SearchURL, &screenshotbuf)); err != nil { - log.Fatal(err) + fmt.Println("This URL or Domain can not be accessed.") + logging.Logerror(err, "Page could not be loaded, URL or domain does not exist.") } log.Printf("Took a screenshot of a request url") -- GitLab