optimize Fatalf with the expectedError Upstream-commit: 766e53d8cb21642ab7ed0cd3f93f6265107ef969 Component: engine