Skip to content

Commit

Permalink
Escl: Throw DeviceOfflineException when a connection times out
Browse files Browse the repository at this point in the history
  • Loading branch information
cyanfish committed Apr 7, 2024
1 parent 7b9c64a commit 5309d5f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions NAPS2.Sdk/Scan/Internal/Escl/EsclScanDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,13 @@ public async Task GetDevices(ScanOptions options, CancellationToken cancelToken,
throw;
}
}
catch (HttpRequestException ex) when (ex.InnerException is TaskCanceledException)
{
// A connection timeout manifests as TaskCanceledException
// TODO: Do we want to add a DeviceCommunicationException? It might be more appropriate here
// (and maps to WIA too)
throw new DeviceOfflineException();
}
catch (TaskCanceledException)
{
}
Expand Down

0 comments on commit 5309d5f

Please sign in to comment.