Merge pull request #2031 from yueh/e-gridconnection-better-logging

Exception during GridConnection now reports the machine and side.
This commit is contained in:
yueh 2015-12-06 14:35:54 +01:00
commit d4692128a5
1 changed files with 6 additions and 3 deletions

View File

@ -77,11 +77,14 @@ public class GridConnection implements IGridConnection, IPathItem
if( a.hasConnection( b ) || b.hasConnection( a ) )
{
final String aCoords = a.getGridBlock().getLocation().toString();
final String bCoords = b.getGridBlock().getLocation().toString();
final String aMachineClass = a.getGridBlock().getMachine().getClass().getSimpleName();
final String bMachineClass = b.getGridBlock().getMachine().getClass().getSimpleName();
final String aCoordinates = a.getGridBlock().getLocation().toString();
final String bCoordinates = b.getGridBlock().getLocation().toString();
throw new GridException( String.format( "Connection already exists between node at [%s] and node at [%s].", aCoords, bCoords ) );
throw new GridException( String.format( "Connection between node [machine=%s, %s] and [machine=%s, %s] on [%s] already exists.", aMachineClass, aCoordinates, bMachineClass, bCoordinates, fromAtoB ) );
}
this.sideA = a;
this.fromAtoB = fromAtoB;
this.sideB = b;