Un argumento de cadena vacía en Get-Date -UFormat ''
arroja IndexOutOfRangeException
, sería más útil si el error dijera qué estaba mal y dirigiera la atención al argumento UFormat. "Cadena UFormat faltante o no válida" o palabras similares.
PS /test> get-date -uformat "$accidentallyEmptyFormatStringVariable"
get-date : Index was outside the bounds of the array.
At line:1 char:1
+ get-date -uformat ''
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-Date], IndexOutOfRangeException
+ FullyQualifiedErrorId : System.IndexOutOfRangeException,Microsoft.PowerShell.Commands.GetDateCommand
A message directing attention to the -UFormat string parameter being empty.
A message about some internal problem.
> $PSVersionTable
Name Value
---- -----
PSVersion 6.0.0-beta.8
PSEdition Core
GitCommitId v6.0.0-beta.8
OS Linux 2.6.32-042stab120.6 #1 SMP Thu Oct 27 16:59:03 MSK 2016
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
De acuerdo, todos los mensajes de error deben ser procesables por el usuario (o informativos si no es posible)
Trabajaré en este.
@DdWr Gracias por agarrar esto. Por lo general, los principiantes reciben la mayoría de los comentarios de estilo. Por favor, lea las Directrices de codificación . Principalmente, debe seguir el estilo del código circundante. También agregue una prueba (use nuestra función ShouldBeErrorId). Coloque un nuevo mensaje de error en el archivo Resx apropiado.
Comentario más útil
Trabajaré en este.