From 656bf92b4d412d6930c3e544ada45cdc24447dd5 Mon Sep 17 00:00:00 2001 From: "Gustavo L de Mello (Guz)" Date: Mon, 27 Jan 2025 09:50:50 -0300 Subject: [PATCH] fix(blogo,core): make error not pointer to better follow std --- blogo/core/errors.go | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/blogo/core/errors.go b/blogo/core/errors.go index 6101281..32da8a5 100644 --- a/blogo/core/errors.go +++ b/blogo/core/errors.go @@ -29,25 +29,37 @@ type ServeError struct { Err error } -func (e *ServeError) Error() string { +func (e ServeError) Error() string { return fmt.Sprintf("failed to serve file on path %q", e.Req.URL.Path) } +func (e ServeError) Unwrap() error { + return e.Err +} + type SourceError struct { Sourcer plugin.Sourcer Err error } -func (e *SourceError) Error() string { +func (e SourceError) Error() string { return fmt.Sprintf("failed to source files with sourcer %q", e.Sourcer.Name()) } +func (e SourceError) Unwrap() error { + return e.Err +} + type RenderError struct { Renderer plugin.Renderer File fs.File Err error } -func (e *RenderError) Error() string { +func (e RenderError) Error() string { return fmt.Sprintf("failed to source files with renderer %q", e.Renderer.Name()) } + +func (e RenderError) Unwrap() error { + return e.Err +}