3 deleted 993 characters in body
source | link

PowerShell, 26 Bytes

'Goodbye Cruel World!';1/0

I think dividing by 0 is the easiest way to throw an error.

PowerShell, 6535/2=322 = 17.5 Bytes

$w='World';"Hello $w";[Environment]::FailFast("Goodbye Cruel $w")

so this probably doesn't count since it fully crashes the shell and only prints this error in the post-crash event logs and crash reports, not to the console.

57/2=28.5

$w='World';"Hello $w";$host.ui|% *err*"Hello "GoodbyeWorld!";Goodbye Cruel $w"World!

this one prints an error line, but then exits without another error.

i'm not aware of a way to have a string as the err message in an actual crashby TessellatingHeckler, however...

44/2=22

$w='World';"Hello $w";"Goodbye Cruel $w";1/0

throws the error message for this one is the followinglike so:

Attempted to divide by zero.
At line:1PS charC:42
+\Users\Connor> $w='World';"Hello"Hello $w";"GoodbyeWorld!";Goodbye Cruel $w";1/0World!
+                      Hello World!
Goodbye : The term 'Goodbye' is not recognized as the name of a cmdlet, function, script file, or operable ~~~program.
    + CategoryInfo  Check the spelling of the name, or if :a NotSpecified:path (:)was []included, RuntimeException
   verify +that FullyQualifiedErrorIdthe :path RuntimeException

which by default includes the full command which was executed, as long as this is executed on a single line, it's guaranteed to include the message.

as the error always includes the full line we can cheat this even more:

37/2=18.5

this throws the following error, which definitely still includes the message, although as a comment.

Attemptedis tocorrect divideand bytry zeroagain.
At line:1 char:1516
+ "Hello World";1/0#Goodbye Cruel World
+               ~~~
    + CategoryInfo          : NotSpecified: (:) [], RuntimeException
    + FullyQualifiedErrorId : RuntimeException

"Hello World";1/0#Goodbye!";Goodbye Cruel World!

PowerShell, 26 Bytes

'Goodbye Cruel World!';1/0

I think dividing by 0 is the easiest way to throw an error.

PowerShell, 65/2=32.5 Bytes

$w='World';"Hello $w";[Environment]::FailFast("Goodbye Cruel $w")

so this probably doesn't count since it fully crashes the shell and only prints this error in the post-crash event logs and crash reports, not to the console.

57/2=28.5

$w='World';"Hello $w";$host.ui|% *err* "Goodbye Cruel $w"

this one prints an error line, but then exits without another error.

i'm not aware of a way to have a string as the err message in an actual crash, however...

44/2=22

$w='World';"Hello $w";"Goodbye Cruel $w";1/0

the error message for this one is the following:

Attempted to divide by zero.
At line:1 char:42
+ $w='World';"Hello $w";"Goodbye Cruel $w";1/0
+                                          ~~~
    + CategoryInfo          : NotSpecified: (:) [], RuntimeException
    + FullyQualifiedErrorId : RuntimeException

which by default includes the full command which was executed, as long as this is executed on a single line, it's guaranteed to include the message.

as the error always includes the full line we can cheat this even more:

37/2=18.5

this throws the following error, which definitely still includes the message, although as a comment.

Attempted to divide by zero.
At line:1 char:15
+ "Hello World";1/0#Goodbye Cruel World
+               ~~~
    + CategoryInfo          : NotSpecified: (:) [], RuntimeException
    + FullyQualifiedErrorId : RuntimeException

"Hello World";1/0#Goodbye Cruel World

PowerShell, 26 Bytes

'Goodbye Cruel World!';1/0

I think dividing by 0 is the easiest way to throw an error.

PowerShell, 35/2 = 17.5 Bytes

"Hello World!";Goodbye Cruel World!

by TessellatingHeckler, throws the error like so:

PS C:\Users\Connor> "Hello World!";Goodbye Cruel World!
Hello World!
Goodbye : The term 'Goodbye' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:16
+ "Hello World!";Goodbye Cruel World!
2 added 1068 characters in body
source | link

PowerShell, 26 Bytes

'Goodbye Cruel World!';1/0

I think dividing by 0 is the easiest way to throw an error.

PowerShell, 65/2=32.5 Bytes

$w='World';"Hello $w";[Environment]::FailFast("Goodbye Cruel $w")

so this probably doesn't count since it fully crashes the shell and only prints this error in the post-crash event logs and crash reports, not to the console.

57/2=28.5

$w='World';"Hello $w";$host.ui|% *err* "Goodbye Cruel $w"

this one prints an error line, but then exits without another error.

i'm not aware of a way to have a string as the err message in an actual crash, however...

44/2=22

$w='World';"Hello $w";"Goodbye Cruel $w";1/0

the error message for this one is the following:

Attempted to divide by zero.
At line:1 char:42
+ $w='World';"Hello $w";"Goodbye Cruel $w";1/0
+                                          ~~~
    + CategoryInfo          : NotSpecified: (:) [], RuntimeException
    + FullyQualifiedErrorId : RuntimeException

which by default includes the full command which was executed, as long as this is executed on a single line, it's guaranteed to include the message.

as the error always includes the full line we can cheat this even more:

37/2=18.5

this throws the following error, which definitely still includes the message, although as a comment.

Attempted to divide by zero.
At line:1 char:15
+ "Hello World";1/0#Goodbye Cruel World
+               ~~~
    + CategoryInfo          : NotSpecified: (:) [], RuntimeException
    + FullyQualifiedErrorId : RuntimeException

"Hello World";1/0#Goodbye Cruel World

PowerShell, 26 Bytes

'Goodbye Cruel World!';1/0

I think dividing by 0 is the easiest way to throw an error.

PowerShell, 26 Bytes

'Goodbye Cruel World!';1/0

I think dividing by 0 is the easiest way to throw an error.

PowerShell, 65/2=32.5 Bytes

$w='World';"Hello $w";[Environment]::FailFast("Goodbye Cruel $w")

so this probably doesn't count since it fully crashes the shell and only prints this error in the post-crash event logs and crash reports, not to the console.

57/2=28.5

$w='World';"Hello $w";$host.ui|% *err* "Goodbye Cruel $w"

this one prints an error line, but then exits without another error.

i'm not aware of a way to have a string as the err message in an actual crash, however...

44/2=22

$w='World';"Hello $w";"Goodbye Cruel $w";1/0

the error message for this one is the following:

Attempted to divide by zero.
At line:1 char:42
+ $w='World';"Hello $w";"Goodbye Cruel $w";1/0
+                                          ~~~
    + CategoryInfo          : NotSpecified: (:) [], RuntimeException
    + FullyQualifiedErrorId : RuntimeException

which by default includes the full command which was executed, as long as this is executed on a single line, it's guaranteed to include the message.

as the error always includes the full line we can cheat this even more:

37/2=18.5

this throws the following error, which definitely still includes the message, although as a comment.

Attempted to divide by zero.
At line:1 char:15
+ "Hello World";1/0#Goodbye Cruel World
+               ~~~
    + CategoryInfo          : NotSpecified: (:) [], RuntimeException
    + FullyQualifiedErrorId : RuntimeException

"Hello World";1/0#Goodbye Cruel World
1
source | link

PowerShell, 26 Bytes

'Goodbye Cruel World!';1/0

I think dividing by 0 is the easiest way to throw an error.