Janne Tuukkanen's helpful answer provides an effective solution.
Taking a step back:
It's understandable to want to avoid the notoriously noisy, multi-line default error formatting in Windows PowerShell and PowerShell [Core] 6.x versions, which can be confusing to end users.
Two - suboptimal - options are:
Use $host.UI.WriteErrorLine($errMsg), which prints just the content of $errMsg in red, without any additional information.
Another option is to use Write-Warning $errMsg, which prints the message in yellow, but prefixes it with WARNING:.
In general, though, it is best not to bypass the usual error reporting features (for consistency and to support further programmatic processing), which PowerShell [Core] 7+ can help with:
PowerShell [Core] 7+ now defaults to concise error formatting, via the ConciseView view that was introduced in 7.0:
With preference variable $ErrorView set to the new default, ConciseView, your command would fail as follows if given a non-integer (prints on a single line, in red; spread across multiple lines here for readability):
Add-Values: Cannot process argument transformation on parameter 'val1'.
Cannot convert value "abc" to type "System.Int32".
Error: "Input string was not in a correct format."
Screen shot (custom background color):

While certainly an improvement over the old formatting, it is still somewhat wordy.
However, you can perform custom validation on parameters via the [ValidateScript()] attribute, which in PowerShell v6+ also supports an ErrorMessage property, so you could do the following:
Function Add-Values
{
param(
[ValidateScript({ ($_ -as [int]) -is [int] }, ErrorMessage='Please pass an integer.')]
[Parameter(Mandatory)]
$val1
,
[ValidateScript({ ($_ -as [int]) -is [int] }, ErrorMessage='Please pass an integer.')]
[Parameter(Mandatory)]
$val2
)
$val1 + $val2
}
Note:
The [ValidateScript()] attribute accepts a script block inside of which the value passed by the user is reflected in the automatic $_ variable. The script block must output a Boolean that indicates whether the value is valid - (effectively) $true) - or not - (effectively) $false.
Only script-block literals ({ ... }) and (non-expandable) string literals are supported inside [ValidateScript()], so the values must be repeated for the two parameters.
($_ -as [int]) -is [int] uses the -as operator to see if the given parameter value ($_) is already an [int] or can be converted to one, and returns an [int] instance if so, and $null otherwise. -is [int] then tests if the -as operation indeed returned an integer or not.
With invalid arguments - e.g., Add-Values abc 2 - you'll then get something like the following:
