fix(iot): 409 различает конфликт name vs device_id (ревью)
store.Create классифицирует 23505 по имени constraint: (namespace,device_id) → ErrDeviceIDExists, иначе ErrAlreadyExists. Handler отдаёт разные 409-сообщения. Помогает Terraform понять, какое поле конфликтует.
This commit is contained in:
@@ -15,6 +15,10 @@ var ErrNotFound = errors.New("device not found")
|
||||
// ErrAlreadyExists — конфликт уникальности (namespace, name) или (namespace, device_id).
|
||||
var ErrAlreadyExists = errors.New("device already exists")
|
||||
|
||||
// ErrDeviceIDExists — конфликт именно по (namespace, device_id) (отличается от
|
||||
// конфликта по name для понятной ошибки API/Terraform, ревью 2026-10-10).
|
||||
var ErrDeviceIDExists = errors.New("device_id already exists")
|
||||
|
||||
// Device — устройство IoT из таблицы iot_devices.
|
||||
type Device struct {
|
||||
Namespace string
|
||||
|
||||
Reference in New Issue
Block a user