Improve device id diagnostic
This commit is contained in:
parent
b804b68a33
commit
2ff324c2d1
1 changed files with 7 additions and 4 deletions
|
|
@ -77,13 +77,16 @@ func New(conf map[string]interface{}, site site.API, httpd *server.HTTPd) (*SEMP
|
|||
|
||||
var did []byte
|
||||
if cc.DeviceID == "" {
|
||||
did, err = uniqueDeviceID()
|
||||
if did, err = uniqueDeviceID(); err != nil {
|
||||
return nil, fmt.Errorf("creating device id: %w", err)
|
||||
}
|
||||
} else {
|
||||
did, err = hex.DecodeString(cc.DeviceID)
|
||||
|
||||
if did, err = hex.DecodeString(cc.DeviceID); err != nil {
|
||||
return nil, fmt.Errorf("device id: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
if err != nil || len(did) != 6 {
|
||||
if len(did) != 6 {
|
||||
return nil, fmt.Errorf("invalid device id: %v", cc.DeviceID)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue