summaryrefslogtreecommitdiff
path: root/panic.go
blob: efab85087f0a4ac0e812ee0157a40aae6e7a47a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package config

import (
	"fmt"

	"google.golang.org/protobuf/proto"
)

// should this be a function?
func LoadPanic(pb proto.Message) error {
	fullname, err := GetFilename(pb)
	if err != nil {
		panic("config.LoadPanic() pb doesn't have pb.Filename")
	}
	if fullname == "" {
		panic("config.LoadPanic() got blank filename = ''")
	}
	err = ReLoad(pb)
	if err != nil {
		panic(fmt.Sprintf("config.LoadPanic() err (%v)", err))
	}

	return nil
}