fix(device-update): err check now uses ErrConstraint
This commit is contained in:
parent
9eb6923398
commit
e8a027ca12
|
@ -17,7 +17,7 @@ func (api *API) DevicesUpdate(ctx context.Context, id int, update *models.Device
|
||||||
if err != nil {
|
if err != nil {
|
||||||
var sqliteErr sqlite3.Error
|
var sqliteErr sqlite3.Error
|
||||||
if errors.As(err, &sqliteErr) {
|
if errors.As(err, &sqliteErr) {
|
||||||
if sqliteErr.Code == sqlite3.ErrNo(sqlite3.ErrConstraintUnique) {
|
if sqliteErr.Code == sqlite3.ErrConstraint {
|
||||||
return errs.Wrapw(err, "a device with the same slug id already exists").Code(409)
|
return errs.Wrapw(err, "a device with the same slug id already exists").Code(409)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue