File tree 1 file changed +9
-5
lines changed
1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -84,11 +84,15 @@ func Create(params *CreateParams) (*DeviceInfo, error) {
84
84
id : dev .Id ,
85
85
}
86
86
if err = prov .run (); err != nil {
87
- // TODO: retry to delete the device if it returns an error.
88
- // In alternative: encapsulate also this error.
89
- iotClient .DeviceDelete (dev .Id )
90
- err = fmt .Errorf ("%s: %w" , "cannot provision device" , err )
91
- return nil , err
87
+ if errDel := iotClient .DeviceDelete (dev .Id ); errDel != nil {
88
+ return nil , fmt .Errorf (
89
+ "device was NOT successfully provisioned but " +
90
+ "now we can't delete it from the cloud - please check " +
91
+ "it on the web application.\n \n Provision error: " + err .Error () +
92
+ "\n Deletion error: " + errDel .Error (),
93
+ )
94
+ }
95
+ return nil , fmt .Errorf ("cannot provision device: %w" , err )
92
96
}
93
97
94
98
devInfo := & DeviceInfo {
You can’t perform that action at this time.
0 commit comments