Move Class and Error to common stacktrace formatting function.