mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-12-26 13:29:05 +01:00
More descriptive errors
This commit is contained in:
parent
42cbf217cd
commit
ac6785448e
@ -53,12 +53,14 @@ func loadJobMeta(filename string) (schema.JobMeta, error) {
|
|||||||
func (fsa *FsArchive) Init(rawConfig json.RawMessage) error {
|
func (fsa *FsArchive) Init(rawConfig json.RawMessage) error {
|
||||||
var config FsArchiveConfig
|
var config FsArchiveConfig
|
||||||
if err := json.Unmarshal(rawConfig, &config); err != nil {
|
if err := json.Unmarshal(rawConfig, &config); err != nil {
|
||||||
|
fmt.Errorf("fsBackend Init()- %w", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fsa.path = config.Path
|
fsa.path = config.Path
|
||||||
|
|
||||||
entries, err := os.ReadDir(fsa.path)
|
entries, err := os.ReadDir(fsa.path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
fmt.Errorf("fsBackend Init()- Cannot read dir %s: %w", fsa.path, err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,7 +98,7 @@ func (fsa *FsArchive) LoadJobMeta(job *schema.Job) (schema.JobMeta, error) {
|
|||||||
func (fsa *FsArchive) LoadClusterCfg(name string) (model.Cluster, error) {
|
func (fsa *FsArchive) LoadClusterCfg(name string) (model.Cluster, error) {
|
||||||
f, err := os.Open(filepath.Join(fsa.path, name, "cluster.json"))
|
f, err := os.Open(filepath.Join(fsa.path, name, "cluster.json"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return model.Cluster{}, err
|
return model.Cluster{}, fmt.Errorf("fsBackend LoadClusterCfg()- Cannot open %s: %w", name, err)
|
||||||
}
|
}
|
||||||
defer f.Close()
|
defer f.Close()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user