Skip to content

Commit 10c15d4

Browse files
committed
NGSM-1569 add additional error handling when there is no active session
Signed-off-by: Jacob Salmela <jacob.salmela@hpe.com>
1 parent ddac6ce commit 10c15d4

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

internal/domain/misc.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ import (
3838

3939
// List returns the inventory
4040
func (d *Domain) List() (inventory.Inventory, error) {
41+
if d == nil {
42+
return inventory.Inventory{}, fmt.Errorf("domain not initialized - no active session found. Run 'session init' to begin")
43+
}
44+
if d.datastore == nil {
45+
return inventory.Inventory{}, fmt.Errorf("datastore not initialized - no active session found. Run 'session init' to begin")
46+
}
47+
4148
inv, err := d.datastore.List()
4249
if err != nil {
4350
return inventory.Inventory{}, err

0 commit comments

Comments
 (0)