Skip to content

Commit c099ebe

Browse files
committed
- fixes hidi release build
1 parent 104f5f5 commit c099ebe

File tree

4 files changed

+33
-1
lines changed

4 files changed

+33
-1
lines changed

src/Microsoft.OpenApi.Hidi/Handlers/PluginCommandHandler.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,24 @@ public async Task<int> InvokeAsync(InvocationContext context)
3535

3636
return 0;
3737
}
38+
#if RELEASE
39+
#pragma warning disable CA1031 // Do not catch general exception types
40+
#endif
3841
catch (Exception ex)
3942
{
4043
#if DEBUG
4144
logger.LogCritical(ex, "Command failed");
4245
throw; // so debug tools go straight to the source of the exception when attached
4346
#else
47+
#pragma warning disable CA2254
4448
logger.LogCritical(ex.Message);
49+
#pragma warning restore CA2254
4550
return 1;
4651
#endif
4752
}
53+
#if RELEASE
54+
#pragma warning restore CA1031 // Do not catch general exception types
55+
#endif
4856
}
4957
}
5058
}

src/Microsoft.OpenApi.Hidi/Handlers/ShowCommandHandler.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,24 @@ public async Task<int> InvokeAsync(InvocationContext context)
3535

3636
return 0;
3737
}
38+
#if RELEASE
39+
#pragma warning disable CA1031 // Do not catch general exception types
40+
#endif
3841
catch (Exception ex)
3942
{
4043
#if DEBUG
4144
logger.LogCritical(ex, "Command failed");
4245
throw; // so debug tools go straight to the source of the exception when attached
4346
#else
47+
#pragma warning disable CA2254
4448
logger.LogCritical( ex.Message);
49+
#pragma warning restore CA2254
4550
return 1;
4651
#endif
4752
}
53+
#if RELEASE
54+
#pragma warning restore CA1031 // Do not catch general exception types
55+
#endif
4856
}
4957
}
5058
}

src/Microsoft.OpenApi.Hidi/Handlers/TransformCommandHandler.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,24 @@ public async Task<int> InvokeAsync(InvocationContext context)
3535

3636
return 0;
3737
}
38+
#if RELEASE
39+
#pragma warning disable CA1031 // Do not catch general exception types
40+
#endif
3841
catch (Exception ex)
3942
{
4043
#if DEBUG
4144
logger.LogCritical(ex, "Command failed");
4245
throw; // so debug tools go straight to the source of the exception when attached
4346
#else
47+
#pragma warning disable CA2254
4448
logger.LogCritical( ex.Message);
49+
#pragma warning restore CA2254
4550
return 1;
4651
#endif
4752
}
53+
#if RELEASE
54+
#pragma warning restore CA1031 // Do not catch general exception types
55+
#endif
4856
}
4957
}
5058
}

src/Microsoft.OpenApi.Hidi/Handlers/ValidateCommandHandler.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,24 @@ public async Task<int> InvokeAsync(InvocationContext context)
3636
await OpenApiService.ValidateOpenApiDocument(hidiOptions.OpenApi, logger, cancellationToken).ConfigureAwait(false);
3737
return 0;
3838
}
39+
#if RELEASE
40+
#pragma warning disable CA1031 // Do not catch general exception types
41+
#endif
3942
catch (Exception ex)
4043
{
4144
#if DEBUG
4245
logger.LogCritical(ex, "Command failed");
4346
throw; // so debug tools go straight to the source of the exception when attached
4447
#else
45-
logger.LogCritical( ex.Message);
48+
#pragma warning disable CA2254
49+
logger.LogCritical(ex.Message);
50+
#pragma warning restore CA2254
4651
return 1;
4752
#endif
4853
}
54+
#if RELEASE
55+
#pragma warning restore CA1031 // Do not catch general exception types
56+
#endif
4957
}
5058
}
5159
}

0 commit comments

Comments
 (0)