Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Commit

Permalink
Error handling instead of panic, year corrected in license
Browse files Browse the repository at this point in the history
  • Loading branch information
marcin-krolik committed Sep 7, 2016
1 parent fbde67a commit 630c119
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
http://www.apache.org/licenses/LICENSE-2.0.txt
Copyright 2015 Intel Corporation
Copyright 2016 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
http://www.apache.org/licenses/LICENSE-2.0.txt
Copyright 2015 Intel Corporation
Copyright 2016 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -79,10 +79,14 @@ func (f *filePublisher) Publish(metrics []plugin.Metric, config plugin.Config) e
func (f *filePublisher) GetConfigPolicy() (plugin.ConfigPolicy, error) {
policy := plugin.NewConfigPolicy()
rule1, err := plugin.NewStringRule("file", true)
handleErr(err)
if err != nil {
return *policy, err
}

rule2, err := plugin.NewBoolRule(debug, false)
handleErr(err)
if err != nil {
return *policy, err
}

policy.AddStringRule([]string{""}, rule1)
policy.AddBoolRule([]string{}, rule2)
Expand All @@ -101,9 +105,3 @@ func formatMetricTagsAsString(metricTags map[string]string) string {

return "tags[" + tags + "]"
}

func handleErr(e error) {
if e != nil {
panic(e)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
http://www.apache.org/licenses/LICENSE-2.0.txt
Copyright 2015 Intel Corporation
Copyright 2016 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
http://www.apache.org/licenses/LICENSE-2.0.txt
Copyright 2015 Intel Corporation
Copyright 2016 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
http://www.apache.org/licenses/LICENSE-2.0.txt
Copyright 2015 Intel Corporation
Copyright 2016 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down

0 comments on commit 630c119

Please sign in to comment.