refactor(error): moved error logic into correct modules

This commit is contained in:
Bryan Bailey
2024-08-27 18:26:30 -04:00
parent b3e99092fc
commit 38aa011199
3 changed files with 18 additions and 19 deletions

View File

@@ -11,6 +11,15 @@ import (
cloudflarebp "github.com/DaRealFreak/cloudflare-bp-go"
)
type ComicDownloadError struct {
Message string
Code int
}
func (c ComicDownloadError) Error() string {
return c.Message
}
// downloadFile downloads a file from a given URL and saves it to a specified location.
//
// The function takes a URL string, a page number, and a Comic struct as parameters.

View File

@@ -1,19 +0,0 @@
package comic
type ImageParseError struct {
Message string
Code int
}
type ComicDownloadError struct {
Message string
Code int
}
func (i ImageParseError) Error() string {
return i.Message
}
func (c ComicDownloadError) Error() string {
return c.Message
}

View File

@@ -8,6 +8,15 @@ import (
"github.com/PuerkitoBio/goquery"
)
type ImageParseError struct {
Message string
Code int
}
func (i ImageParseError) Error() string {
return i.Message
}
// Markup retrieves the HTML content from a given URL and returns a goquery Document.
//
// url is the URL to retrieve the HTML content from.