Exception during GridConnection now reports the machine and side.

This commit is contained in:
yueh 2015-11-30 12:55:47 +01:00
parent 824ec1eccb
commit 599e6f3e64
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;