refactor(error): moved error logic into correct modules
This commit is contained in:
@@ -11,6 +11,15 @@ import (
|
|||||||
cloudflarebp "github.com/DaRealFreak/cloudflare-bp-go"
|
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.
|
// 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.
|
// The function takes a URL string, a page number, and a Comic struct as parameters.
|
||||||
|
|||||||
@@ -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
|
|
||||||
}
|
|
||||||
@@ -8,6 +8,15 @@ import (
|
|||||||
"github.com/PuerkitoBio/goquery"
|
"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.
|
// Markup retrieves the HTML content from a given URL and returns a goquery Document.
|
||||||
//
|
//
|
||||||
// url is the URL to retrieve the HTML content from.
|
// url is the URL to retrieve the HTML content from.
|
||||||
|
|||||||
Reference in New Issue
Block a user