From 1ab91b7ef9fb314dbb6a15f68d1ec293186f8767 Mon Sep 17 00:00:00 2001 From: Matt Holt Date: Wed, 17 Aug 2016 10:07:20 -0600 Subject: [PATCH] Clarify error reporting --- Writing-a-Plugin:-Caddyfile-Loader.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Writing-a-Plugin:-Caddyfile-Loader.md b/Writing-a-Plugin:-Caddyfile-Loader.md index 5e42ebc..c2584ff 100644 --- a/Writing-a-Plugin:-Caddyfile-Loader.md +++ b/Writing-a-Plugin:-Caddyfile-Loader.md @@ -18,7 +18,9 @@ func myLoader(serverType string) (caddy.Input, error) { } ``` -If your loader needs more state, you can implement the caddy.Loader interface directly using a struct, instead of using the wrapper type like we did above. Simple loaders need only be standalone functions. +If your loader needs more state, you can implement the caddy.Loader interface directly using a struct, instead of using the wrapper type `caddy.LoaderFunc` like we did above. Simple loaders need only be standalone functions. + +Your loader should return an error only if it is worth aborting and reporting to the user. In other words, do not return an error merely because there is no Caddyfile for your loader to load. ## How Loaders are Used