Skip to content

Commit

Permalink
fixing error handling and logging of app
Browse files Browse the repository at this point in the history
  • Loading branch information
darthvader2 committed Jun 11, 2024
1 parent a6c1ca7 commit de09893
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
web/content/datasets/*
charts/
dev_utils/
dev_utils/*
4 changes: 1 addition & 3 deletions download_metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,9 @@ func metadataDownloader(Metadataclient *MetadataBackend) {
err := downloadToFile(manager, LocalDirectory, Bucket, aws.ToString(obj.Key))
if err != nil {
log.Fatal("Error while downloading metadata files from metadata bucket", err)
} else {
log.Infoln("Completed downloading metadatafiles")

}
}
log.Infoln("Completed downloading metadata files")

}

Expand Down
11 changes: 6 additions & 5 deletions markdown_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,17 @@ func markDownCreator() {

// Read XML file name
xmlFileName := filepath.Base(xmlFilePath)
fmt.Println(xmlFilePath)
log.Debug(xmlFilePath)
xmlContent, err := readXMLFile(xmlFilePath)
if err != nil {
fmt.Println(err)
log.Fatalf("Error reading the XML file %V", err)
}
headerValue, err := getHeaderValueFromXMLContent(xmlContent)
if err != nil {
fmt.Println(err)
log.Fatal("Error while getting header value from XML file", err)
}

fmt.Printf("Header value: %s\n", headerValue)
log.Debugln("Header value: %V", headerValue)
// Remove file extension
fileNameWithoutExt := strings.TrimSuffix(xmlFileName, filepath.Ext(xmlFileName))

Expand Down Expand Up @@ -76,12 +76,13 @@ Filename of the associated XML file: %s
return nil
}

log.Infoln("Markdown file %S created successfully!\n", mdFileName)
log.Debug("Markdown file %S created successfully!\n", mdFileName)

return nil
})

if err != nil {
log.Fatal("Error walking through directory:", err)
}

}
6 changes: 4 additions & 2 deletions static_files_uploader.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/aws/aws-sdk-go-v2/service/s3"
)

func test(DeploymenClient *DeploymentBackend) {
func staticSiteUploader(DeploymenClient *DeploymentBackend) {
var (
localPath = "web/public/"
bucket = DeploymenClient.Bucket
Expand Down Expand Up @@ -71,8 +71,10 @@ func test(DeploymenClient *DeploymentBackend) {
if err != nil {
log.Fatalln("Failed to upload", path, err)
}
log.Infoln("Uploaded", path, result.Location)
log.Debugln("Uploaded", path, result.Location)
}
log.Infoln("Successfully uploaded built static site to the bucket")

}

type fileWalk chan string
Expand Down

0 comments on commit de09893

Please sign in to comment.