diff options
Diffstat (limited to 'caddyconfig')
-rw-r--r-- | caddyconfig/configadapters.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/caddyconfig/configadapters.go b/caddyconfig/configadapters.go index 96d7e10..2c466c4 100644 --- a/caddyconfig/configadapters.go +++ b/caddyconfig/configadapters.go @@ -101,13 +101,14 @@ func JSONIndent(val interface{}) ([]byte, error) { } // RegisterAdapter registers a config adapter with the given name. -// This should usually be done at init-time. -func RegisterAdapter(name string, adapter Adapter) error { +// This should usually be done at init-time. It panics if the +// adapter cannot be registered successfully. +func RegisterAdapter(name string, adapter Adapter) { if _, ok := configAdapters[name]; ok { - return fmt.Errorf("%s: already registered", name) + panic(fmt.Errorf("%s: already registered", name)) } configAdapters[name] = adapter - return caddy.RegisterModule(adapterModule{name, adapter}) + caddy.RegisterModule(adapterModule{name, adapter}) } // GetAdapter returns the adapter with the given name, |