(
command: string,
device: DeviceInfo,
options?: { message?: string; hint?: boolean },
)
| 32 | * device-specific unsupported hint (as generic command dispatch does). |
| 33 | */ |
| 34 | export function requireCommandSupported( |
| 35 | command: string, |
| 36 | device: DeviceInfo, |
| 37 | options?: { message?: string; hint?: boolean }, |
| 38 | ): DaemonFailureResponse | null { |
| 39 | if (isCommandSupportedOnDevice(command, device)) return null; |
| 40 | const hint = options?.hint ? unsupportedHintForDevice(command, device) : undefined; |
| 41 | return { |
| 42 | ok: false, |
| 43 | error: { |
| 44 | code: 'UNSUPPORTED_OPERATION', |
| 45 | message: options?.message ?? `${command} is not supported on this device`, |
| 46 | ...(hint ? { hint } : {}), |
| 47 | }, |
| 48 | }; |
| 49 | } |
no test coverage detected