In the first occurrence, $(sourceCodeSnippet) is replaced in the code, and later evaluated (and the result of this evaluation will be passed to the const result).
In the second occurrence, it is replaced inside a string, so it doesn't get evaluated, but the source code is just treated as a string (and displayed in the error message).
Note that the macro nullthrows is just generating some code depending of sourceCodeSnippet, and this code will be evaluated later.