PyPackageInstallationErrorDescription (@NotNull ExecutionException e, @Nullable Sdk sdk, @Nullable String packageName) { if (e instanceof PyExecutionException ee) { final String stdout = ee.getStdout(); final String stdoutCause = findErrorCause(stdout); final String stderrCause = findErrorCause(ee.getStderr()); final String cause = stdoutCause != null ? stdoutCause : stderrCause; final String message = cause != null ? cause : ee.getMessage(); final String command = ee.getCommand() + " " + StringUtil.join(ee.getArgs(), " "); return new PyPackageInstallationErrorDescription(message, command, stdout.isEmpty() ? ee.getStderr() : stdout + "\n" + ee.getStderr(), findErrorSolution(ee, cause, sdk), packageName, sdk); } else { return new PyPackageInstallationErrorDescription(e.getMessage(), null, null, null, packageName, sdk); } }