Documentation
¶
Index ¶
- Variables
- func CalculateFileSHA256(filePath string) (string, error)
- func CalculateStringSHA256(content string) string
- func CategorizeError(err error) string
- func CompileRegexPatterns(patterns []string) ([]*regexp.Regexp, error)
- func GenerateAndSaveTreeStructure(targetDir, outputFilePath string, log *logrus.Entry) error
- func SanitizeFilename(name string) string
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrRetryFailed = errors.New("request failed after all retries") // Wraps the last underlying error ErrClientHTTPError = errors.New("client HTTP error (4xx)") // Wraps original error/status ErrServerHTTPError = errors.New("server HTTP error (5xx)") // Wraps original error/status ErrOtherHTTPError = errors.New("other HTTP error (non-2xx)") // Wraps original error/status ErrRobotsDisallowed = errors.New("disallowed by robots.txt") ErrScopeViolation = errors.New("URL out of scope (domain/prefix/pattern)") ErrMaxDepthExceeded = errors.New("maximum crawl depth exceeded") ErrContentSelector = errors.New("content selector not found") ErrParsing = errors.New("parsing error") // Wraps specific parsing error (HTML, URL, JSON, XML) ErrFilesystem = errors.New("filesystem error") // Wraps os errors ErrDatabase = errors.New("database error") // Wraps badger errors ErrSemaphoreTimeout = errors.New("timeout acquiring semaphore") ErrRequestCreation = errors.New("failed to create HTTP request") ErrResponseBodyRead = errors.New("failed to read response body") ErrMarkdownConversion = errors.New("failed to convert HTML to markdown") ErrConfigValidation = errors.New("configuration validation error") ErrNonHTMLContent = errors.New("non-HTML content type") )
--- Sentinel Errors for Categorization ---
Functions ¶
func CalculateFileSHA256 ¶
CalculateFileSHA256 computes the SHA-256 hash of a file's content.
func CalculateStringSHA256 ¶
CalculateStringSHA256 computes the SHA-256 hash of a string.
func CategorizeError ¶
CategorizeError maps an error to a predefined category string for logging/metrics.
func CompileRegexPatterns ¶
CompileRegexPatterns compiles regex strings into usable *regexp.Regexp objects. Returns an error if any pattern is invalid.
func GenerateAndSaveTreeStructure ¶
GenerateAndSaveTreeStructure walks the targetDir and writes a text-based directory tree structure to the specified outputFilePath
func SanitizeFilename ¶
SanitizeFilename cleans a string to be safe for use as a filename component
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.