Update the error line

This commit is contained in:
Markus Fleschutz
2021-09-16 20:19:10 +02:00
parent 0b65a7ecf7
commit bf8ddfbe0b
190 changed files with 198 additions and 204 deletions

View File

@ -73,9 +73,8 @@ function Char2MorseCode { param([string]$Char)
}
try {
if ($Text -eq "" ) {
[string]$Text = read-host "Enter text to write"
}
if ($Text -eq "" ) { [string]$Text = read-host "Enter text to write" }
[char[]]$ArrayOfChars = $Text.ToUpper()
foreach($Char in $ArrayOfChars) {
Char2MorseCode $Char
@ -84,6 +83,6 @@ try {
write-host ""
exit 0
} catch {
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
exit 1
}