Skip to content

Commit

Permalink
Merge pull request #36 from Laerdal/ksidirop/MAN-225-fw-install-file-…
Browse files Browse the repository at this point in the history
…upload-retry-enhancement

refa: convert '!(ex is FooException)' to 'ex is not FooException' which is more readable
  • Loading branch information
ksidirop-laerdal authored Aug 29, 2023
2 parents 2436e48 + d1581f4 commit b162c2c
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions Laerdal.McuMgr/Shared/DeviceResetter/DeviceResetter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ public async Task ResetAsync(int timeoutInMs = -1)
throw new DeviceResetTimeoutException(timeoutInMs, ex);
}
catch (Exception ex) when (
!(ex is ArgumentException) //10 wops probably missing native lib symbols!
&& !(ex is TimeoutException)
ex is not ArgumentException //10 wops probably missing native lib symbols!
&& ex is not TimeoutException
&& !(ex is IDeviceResetterException)
)
{
Expand Down
4 changes: 2 additions & 2 deletions Laerdal.McuMgr/Shared/FileDownloader/FileDownloader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,8 @@ public async Task<byte[]> DownloadAsync(
continue;
}
catch (Exception ex) when (
!(ex is ArgumentException) //10 wops probably missing native lib symbols!
&& !(ex is TimeoutException)
ex is not ArgumentException //10 wops probably missing native lib symbols!
&& ex is not TimeoutException
&& !(ex is IDownloadException) //this accounts for both cancellations and download exceptions!
)
{
Expand Down
4 changes: 2 additions & 2 deletions Laerdal.McuMgr/Shared/FileUploader/FileUploader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,8 @@ public async Task UploadAsync(
continue;
}
catch (Exception ex) when (
!(ex is ArgumentException) //10 wops probably missing native lib symbols!
&& !(ex is TimeoutException)
ex is not ArgumentException //10 wops probably missing native lib symbols!
&& ex is not TimeoutException
&& !(ex is IUploadException) //this accounts for both cancellations and upload errors
)
{
Expand Down
4 changes: 2 additions & 2 deletions Laerdal.McuMgr/Shared/FirmwareEraser/FirmwareEraser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ public async Task EraseAsync(int imageIndex = 1, int timeoutInMs = -1)
throw new FirmwareErasureTimeoutException(timeoutInMs, ex);
}
catch (Exception ex) when (
!(ex is ArgumentException) //10 wops probably missing native lib symbols!
&& !(ex is TimeoutException)
ex is not ArgumentException //10 wops probably missing native lib symbols!
&& ex is not TimeoutException
&& !(ex is IFirmwareEraserException)
)
{
Expand Down
6 changes: 3 additions & 3 deletions Laerdal.McuMgr/Shared/FirmwareInstaller/FirmwareInstaller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,9 @@ public async Task InstallAsync(
continue;
}
catch (Exception ex) when (
!(ex is ArgumentException) //10 wops probably missing native lib symbols!
&& !(ex is TimeoutException)
&& !(ex is IFirmwareInstallationException) //this accounts for both cancellations and installation errors
ex is not ArgumentException //10 wops probably missing native lib symbols!
&& ex is not TimeoutException
&& ex is not IFirmwareInstallationException //this accounts for both cancellations and installation errors
)
{
OnStateChanged(new StateChangedEventArgs( //for consistency
Expand Down

0 comments on commit b162c2c

Please sign in to comment.