Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add New-Exception, and PassThru parameter to exception commands #115

Merged
merged 7 commits into from
Jan 23, 2024

Conversation

johlju
Copy link
Member

@johlju johlju commented Jan 22, 2024

Pull Request (PR) description

  • Wiki source file HOME was modified to not link to README for help after
    command documentation now is in the wiki.
  • New-Exception
    • New command that creates and returns an [System.Exception].
  • New-ArgumentException
    • Now takes a parameter PassThru that returns the error record that was
      created (and does not throw).
    • Now has a command alias New-InvalidArgumentException and the command
      was renamed to match the exception name.
  • New-InvalidOperationException
    • Now takes a parameter PassThru that returns the error record that was
      created (and does not throw) (issue #98).
  • New-InvalidResultException
    • Now takes a parameter PassThru that returns the error record that was
      created (and does not throw).
  • New-NotImplementedException
    • Now takes a parameter PassThru that returns the error record that was
  • New-InvalidDataException
    • The parameter Message has a parameter alias ErrorMessage to make
      the command have the same parameter names as the other New-*Exception
      commands.
  • New-ObjectNotFoundException
    • Updated typo in comment-based help.

This Pull Request (PR) fixes the following issues

Task list

  • Added an entry to the change log under the Unreleased section of the
    file CHANGELOG.md. Entry should say what was changed and how that
    affects users (if applicable), and reference the issue being resolved
    (if applicable).
  • Documentation added/updated in README.md.
  • Comment-based help added/updated for all new/changed functions.
  • Localization strings added/updated in all localization files as appropriate.
  • Examples appropriately added/updated.
  • Unit tests added/updated. See DSC Community Testing Guidelines.
  • Integration tests added/updated (where possible). See
    DSC Community Testing Guidelines.
  • New/changed code adheres to DSC Community Style Guidelines.

This change is Reviewable

@johlju johlju added the needs review The pull request needs a code review. label Jan 22, 2024
@johlju johlju changed the title Add PassThru parameter to error record creation functions Add New-Exception, and PassThru parameter to exception commands Jan 22, 2024
Copy link
Member Author

@johlju johlju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 12 of 12 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion


source/Public/New-ObjectNotFoundException.ps1 line 52 at r1 (raw file):

    if ($null -eq $ErrorRecord)
    {
        $exception = New-Object -TypeName 'System.Exception' `

We can use the New-Exception for this instead? Also for New-InvalidResultExceptionx.

Copy link
Member Author

@johlju johlju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 2 of 2 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @johlju)

Copy link
Member Author

@johlju johlju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @johlju)

Copy link

codecov bot commented Jan 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (1ada77f) 91% compared to head (8495e30) 91%.

Additional details and impacted files

Impacted file tree graph

@@         Coverage Diff         @@
##           main   #115   +/-   ##
===================================
  Coverage    91%    91%           
===================================
  Files        37     38    +1     
  Lines       664    668    +4     
===================================
+ Hits        609    613    +4     
  Misses       55     55           
Files Coverage Δ
source/Public/New-ArgumentException.ps1 100% <100%> (ø)
source/Public/New-Exception.ps1 100% <100%> (ø)
source/Public/New-InvalidDataException.ps1 100% <ø> (ø)
source/Public/New-InvalidOperationException.ps1 100% <100%> (ø)
source/Public/New-InvalidResultException.ps1 100% <100%> (ø)
source/Public/New-NotImplementedException.ps1 100% <100%> (ø)
source/Public/New-ObjectNotFoundException.ps1 100% <100%> (ø)

@johlju johlju merged commit f06681b into dsccommunity:main Jan 23, 2024
10 of 11 checks passed
@johlju johlju removed the needs review The pull request needs a code review. label Jan 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New-InvalidOperationException: Suggest adding a PassThru parameter
1 participant