Un argument de chaîne vide dans Get-Date -UFormat ''
lance IndexOutOfRangeException
, il serait plus utile si l'erreur disait ce qui n'allait pas et attirait l'attention sur l'argument UFormat. "Chaîne UFormat manquante ou non valide" ou des mots à cet effet.
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
D'accord, tous les messages d'erreur doivent être exploitables par l'utilisateur (ou informatifs si ce n'est pas possible)
Je vais travailler sur celui-ci.
@DdWr Merci d'avoir saisi ceci. En règle générale, les débutants reçoivent la plupart des commentaires de style. Veuillez lire les directives de codage . Vous devez principalement suivre le style du code environnant. Veuillez également ajouter un test (utilisez notre fonction ShouldBeErrorId). Mettez le nouveau message d'erreur dans le fichier Resx approprié.
Commentaire le plus utile
Je vais travailler sur celui-ci.