Skip to content

.Net Processes - Update Runtime Exception Handling / Logging#9457

Merged
crickman merged 4 commits intomainfrom
process-runtime-logging
Oct 30, 2024
Merged

.Net Processes - Update Runtime Exception Handling / Logging#9457
crickman merged 4 commits intomainfrom
process-runtime-logging

Conversation

@crickman
Copy link
Contributor

Motivation and Context

Throwing and logging exceptions in the runtime is a little verbose. It also creates quite a few conditional arcs for test coverage (or lack there-of). Utility method streamlines this pattern and eliminates all but one conditional arc.

throw new KernelException("message").Log(this._logger);

Note: Considered this pattern, opted on favoring the never-null object as the root of the extention method.

throw this._logger.LogException(new KernelException("message"));

Description

  • Introduced shared exception extension to streamline logging and minimize conditional arcs.
  • Switched to LogError override that accepts the exception object.
  • Initialize logger based on Kernel.LoggingFactory (was previously always null)
  • Opportunistically added parameter names to usage of Verify
  • Opportunistically removed async/await for methods where not required.

Contribution Checklist

@crickman crickman added PR: ready for review All feedback addressed, ready for reviews .NET Issue or Pull requests regarding .NET code experimental Associated with an experimental feature enhancement processes labels Oct 29, 2024
@crickman crickman self-assigned this Oct 29, 2024
@crickman crickman requested a review from a team as a code owner October 29, 2024 17:11
@crickman crickman changed the title .Net Agents - Update Runtime Exceptions .Net Processes - Update Runtime Exceptions Oct 29, 2024
@crickman crickman changed the title .Net Processes - Update Runtime Exceptions .Net Processes - Update Runtime Exception Handling / Logging Oct 30, 2024
@crickman crickman added this pull request to the merge queue Oct 30, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to a conflict with the base branch Oct 30, 2024
@crickman crickman added this pull request to the merge queue Oct 30, 2024
Merged via the queue into main with commit 82f248f Oct 30, 2024
@crickman crickman deleted the process-runtime-logging branch October 30, 2024 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement experimental Associated with an experimental feature .NET Issue or Pull requests regarding .NET code PR: ready for review All feedback addressed, ready for reviews processes

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants