diff --git a/src/main/java/io/appium/java_client/remote/AppiumCommandExecutor.java b/src/main/java/io/appium/java_client/remote/AppiumCommandExecutor.java index 0acc215f8..5e3184f14 100644 --- a/src/main/java/io/appium/java_client/remote/AppiumCommandExecutor.java +++ b/src/main/java/io/appium/java_client/remote/AppiumCommandExecutor.java @@ -191,13 +191,16 @@ public Result createSession(HttpClient client, Command command) return toReturn; }).orElseThrow(() -> new SessionNotCreatedException( format("Unable to create new remote session. desired capabilities = %s", desired))); - } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { + } catch (NoSuchMethodException | IllegalAccessException e) { throw new WebDriverException(format("It is impossible to create a new session " + "because 'createSession' which takes %s, %s and %s was not found " + "or it is not accessible", HttpClient.class.getSimpleName(), InputStream.class.getSimpleName(), long.class.getSimpleName()), e); + } catch (InvocationTargetException e) { + throw new SessionNotCreatedException( + format("Unable to create new remote session. Desired capabilities: %s", desired), e); } } finally { os.reset();