This logic is wrong. We cannot assume that the first line in the stacktrace is coming from the user code, even if the error is an assertion. It can come from a test helper, for example.