Skip to content
Snippets Groups Projects
Commit 98dec9f3 authored by Odin K. Henriksen's avatar Odin K. Henriksen
Browse files

Stops the program from breaking if the URL or Domain does not exist

parent c2c0228a
Branches
No related tags found
No related merge requests found
...@@ -2,9 +2,10 @@ package utils ...@@ -2,9 +2,10 @@ package utils
import ( import (
"context" "context"
"fmt"
"log" "log"
"strings" "strings"
logging "dcsg2900-threattotal/logs"
"github.com/chromedp/chromedp" "github.com/chromedp/chromedp"
) )
...@@ -35,7 +36,8 @@ func ScreenshotURL(url string, Response *ResultFrontendResponse) { ...@@ -35,7 +36,8 @@ func ScreenshotURL(url string, Response *ResultFrontendResponse) {
// Take the screenshot using the screenScreenshot function // Take the screenshot using the screenScreenshot function
if err := chromedp.Run(ctx, screenScreenshot(SearchURL, &screenshotbuf)); err != nil { 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") log.Printf("Took a screenshot of a request url")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment