Improved exceptions

Many exceptions got an improvement due to changed class or description or details it is providing.
Is not complete, needs to be done in patches in the regions, where it is needed, since some are just
swallowed.

Removed total usage of pure RuntimeExceptions to 0.
This commit is contained in:
thatsIch
2015-03-23 10:14:35 +01:00
parent 817163dbf6
commit 3783ae8619
76 changed files with 288 additions and 290 deletions
+1 -1
View File
@@ -305,7 +305,7 @@ public class GridNode implements IGridNode, IPathItem
this.setGridStorage( WorldSettings.getInstance().getGridStorage( node.getLong( "g" ) ) );
}
else
throw new RuntimeException( "Loading data after part of a grid, this is invalid." );
throw new IllegalStateException( "Loading data after part of a grid, this is invalid." );
}
@Override
+4 -4
View File
@@ -71,16 +71,16 @@ public class NetworkEventBus
classEvents.put( listAs, thisEvent );
}
else
throw new RuntimeException( "Invalid ME Network Event Subscriber, " + m.getName() + "s Parameter must extend MENetworkEvent." );
throw new IllegalStateException( "Invalid ME Network Event Subscriber, " + m.getName() + "s Parameter must extend MENetworkEvent." );
}
else
throw new RuntimeException( "Invalid ME Network Event Subscriber, " + m.getName() + " must have exactly 1 parameter." );
throw new IllegalStateException( "Invalid ME Network Event Subscriber, " + m.getName() + " must have exactly 1 parameter." );
}
}
}
catch( Throwable t )
{
throw new RuntimeException( "Error while adding " + c.getName() + " to event bus", t );
throw new IllegalStateException( "Error while adding " + c.getName() + " to event bus", t );
}
}
@@ -179,7 +179,7 @@ public class NetworkEventBus
AELog.severe( "Offending Class: " + obj.getClass().getName() );
AELog.severe( "Offending Object: " + obj.toString() );
AELog.error( e1 );
throw new RuntimeException( e1 );
throw new IllegalStateException( e1 );
}
if( e.isCanceled() )
+1 -1
View File
@@ -501,7 +501,7 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
{
if( world == null || grid == null || actionSrc == null || slotItem == null )
{
throw new RuntimeException( "Invalid Crafting Job Request" );
throw new IllegalArgumentException( "Invalid Crafting Job Request" );
}
CraftingJob job = new CraftingJob( world, grid, actionSrc, slotItem, cb );
+1 -1
View File
@@ -140,6 +140,6 @@ public class NetworkMonitor<T extends IAEStack<T>> extends MEMonitorHandler<T>
final NetworkMonitor<?> last = DEPTH.pop();
if( last != this )
throw new RuntimeException( "Invalid Access to Networked Storage API detected." );
throw new IllegalStateException( "Invalid Access to Networked Storage API detected." );
}
}
@@ -934,7 +934,7 @@ public class CraftingCPUCluster implements IAECluster, ICraftingCPU
public IAEItemStack getItemStack( IAEItemStack what, CraftingItemList storage2 )
{
IAEItemStack is = null;
IAEItemStack is;
switch( storage2 )
{
case STORAGE:
@@ -960,7 +960,7 @@ public class CraftingCPUCluster implements IAECluster, ICraftingCPU
break;
default:
case ALL:
throw new RuntimeException( "Invalid Operation" );
throw new IllegalStateException( "Invalid Operation" );
}
if( is != null )
@@ -168,7 +168,7 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
private void surface( NetworkInventoryHandler<T> networkInventoryHandler, Actionable type )
{
if( this.getDepth( type ).pop() != this )
throw new RuntimeException( "Invalid Access to Networked Storage API detected." );
throw new IllegalStateException( "Invalid Access to Networked Storage API detected." );
}
private LinkedList getDepth( Actionable type )