Skip to content

Commit 48182ba

Browse files
Paolo CalaoGiuseppe Lumia
andauthored
Update command/device/createlora.go
Co-authored-by: Giuseppe Lumia <g.lumia@outlook.com>
1 parent 5a88a5f commit 48182ba

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

command/device/createlora.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,15 @@ func CreateLora(params *CreateLoraParams) (*DeviceLoraInfo, error) {
100100

101101
devInfo, err := getDeviceLoraInfo(iotClient, dev)
102102
if err != nil {
103-
iotClient.DeviceDelete(dev.DeviceId)
103+
errDel := iotClient.DeviceDelete(dev.DeviceId)
104+
if errDel != nil { // Oh no
105+
panic(
106+
"device was successfully provisioned and configured on IoT-API but " +
107+
"now we can't fetch its information nor delete it - please check " +
108+
"it on the web application.\n\nFetch error: " + err.Error() +
109+
"\nDeletion error: " + errDel.Error(),
110+
)
111+
}
104112
return nil, fmt.Errorf("%s: %w", "cannot provision LoRa device", err)
105113
}
106114
return devInfo, nil

0 commit comments

Comments
 (0)