Skip to content

Commit

Permalink
Shortening string representation of capabilities in exceptions thrown…
Browse files Browse the repository at this point in the history
… by grid
  • Loading branch information
barancev committed Dec 20, 2013
1 parent e0bdd6b commit 8135e70
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

package org.openqa.grid.common.exception;

import org.openqa.selenium.remote.DesiredCapabilities;

import java.util.Map;

public class CapabilityNotPresentOnTheGridException extends GridException {
Expand All @@ -28,6 +30,6 @@ public CapabilityNotPresentOnTheGridException(String msg) {
}

public CapabilityNotPresentOnTheGridException(Map<String, Object> capabilities) {
super("cannot find : " + capabilities);
super("cannot find : " + new DesiredCapabilities(capabilities));
}
}
6 changes: 4 additions & 2 deletions java/server/src/org/openqa/grid/internal/ProxySet.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import org.openqa.grid.common.exception.CapabilityNotPresentOnTheGridException;
import org.openqa.grid.common.exception.GridException;
import org.openqa.selenium.remote.DesiredCapabilities;

import java.util.ArrayList;
import java.util.Collections;
Expand Down Expand Up @@ -152,7 +153,8 @@ public int size() {
public void verifyAbilityToHandleDesiredCapabilities(Map<String, Object> desiredCapabilities) {
if (proxies.isEmpty()) {
if (throwOnCapabilityNotPresent) {
throw new GridException("Empty pool of VM for setup " + desiredCapabilities);
throw new GridException("Empty pool of VM for setup "
+ new DesiredCapabilities(desiredCapabilities));
} else {
log.warning("Empty pool of nodes.");
}
Expand All @@ -162,7 +164,7 @@ public void verifyAbilityToHandleDesiredCapabilities(Map<String, Object> desired
if (throwOnCapabilityNotPresent) {
throw new CapabilityNotPresentOnTheGridException(desiredCapabilities);
} else {
log.warning("grid doesn't contain " + desiredCapabilities +
log.warning("grid doesn't contain " + new DesiredCapabilities(desiredCapabilities) +
" at the moment.");
}

Expand Down

0 comments on commit 8135e70

Please sign in to comment.