EliziumNet / Loopz

PowerShell iteration utilities with additional tools like the Parameter Set Tools
https://eliziumnet.github.io/Loopz/
MIT License
3 stars 0 forks source link

Rename-Many: Exception occurs when anchor fails match #101

Closed plastikfan closed 3 years ago

plastikfan commented 3 years ago

Sancho@JANUS  ~\dev\tree  [20:32]

λ gci $dir | remy -Pattern '(?\d{4})-(?\d{2})-(?\d{2}) -' -Anchor '(x?\d{2})' -Paste ' (${y}-${m}-${d}) ${_a}' -WhatIf [😍] ----------------------------------------------------------------------------------------------------- [ Rename ] --- Exception calling "InvokeReturnAsIs" with "4" argument(s): "Cannot convert the "System.Object[]" value of type "System.Object[]" to type "couplet"." ⨯ Sancho@JANUS  ~\dev\tree  [20:32]

plastikfan commented 3 years ago

The exception handler should show show the error

plastikfan commented 3 years ago

This was caused by a bad signal definition as a custom override in profile:

'NOT-ACTIONED' = @('Not Actioned', '🥀');

which should be: 'NOT-ACTIONED' = (kp(@('Not Actioned', '🥀')));

can be avoided by using Update-CustomSignals, which validates signal entries.

However, we still need an update to show the call stack and exception message if ever an error occurs.