feat: add errorHandler if resource could not be loaded
- Fixes #7 - Fixes #6 - Add "errorHandler" config key - Add the following error-handlers: - `warning`: prints warning if resource not found under 'assets' - `warning-remote`: prints warning, but tries RemoteGet as alternative - `error`: prints error if resource not found, fails build
This commit is contained in:
@@ -0,0 +1 @@
|
||||
{{ errorf "image path './assets/%s' does not exist. please check the 'assets' directory." .img }}
|
||||
@@ -0,0 +1,12 @@
|
||||
{{ $params := . }}
|
||||
{{ $url := .img | absURL }}
|
||||
{{ warnf "image path './assets/%s' does not exist. trying remote get via %s" .img $url }}
|
||||
{{ $res := false }}
|
||||
{{ with $resource := resources.GetRemote $url }}
|
||||
{{ with .Err }}
|
||||
{{ warnf "could not get remotely: %s: %#v" .Error .Data }}
|
||||
{{ else }}
|
||||
{{ $res = merge $params (dict "img" $resource) }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ return $res }}
|
||||
@@ -0,0 +1 @@
|
||||
{{ warnf "image path './assets/%s' does not exist. please check the 'assets' directory." .img }}
|
||||
Reference in New Issue
Block a user