mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Changed the error handling and the error messages.
This commit is contained in:
parent
8dad35d75f
commit
c8235eee79
5 changed files with 35 additions and 20 deletions
|
@ -11,6 +11,8 @@ import org.eclipse.cdt.debug.core.CDebugModel;
|
|||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||
import org.eclipse.cdt.debug.core.cdi.ICDISession;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
|
||||
import org.eclipse.cdt.debug.internal.core.CDebugUtils;
|
||||
import org.eclipse.cdt.debug.internal.core.ICDebugInternalConstants;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.PlatformObject;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
|
@ -262,4 +264,14 @@ public class CDebugElement extends PlatformObject
|
|||
message,
|
||||
exception ) );
|
||||
}
|
||||
|
||||
protected void infoMessage( Throwable e )
|
||||
{
|
||||
IStatus newStatus = new Status( IStatus.INFO,
|
||||
CDebugCorePlugin.getUniqueIdentifier(),
|
||||
ICDebugInternalConstants.STATUS_CODE_INFO,
|
||||
e.getMessage(),
|
||||
null );
|
||||
CDebugUtils.info( newStatus, getDebugTarget() );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -572,7 +572,7 @@ public class CStackFrame extends CDebugElement
|
|||
}
|
||||
catch( CDIException e )
|
||||
{
|
||||
targetRequestFailed( MessageFormat.format( "{0} occurred retrieving local variables", new String[] { e.toString() } ), e );
|
||||
targetRequestFailed( e.toString(), null );
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
@ -591,7 +591,7 @@ public class CStackFrame extends CDebugElement
|
|||
}
|
||||
catch( CDIException e )
|
||||
{
|
||||
targetRequestFailed( MessageFormat.format( "{0} occurred retrieving arguments", new String[] { e.toString() } ), e );
|
||||
targetRequestFailed( e.toString(), null );
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
|
|
@ -246,11 +246,9 @@ public class CThread extends CDebugElement
|
|||
}
|
||||
catch( CDIException e )
|
||||
{
|
||||
requestFailed( MessageFormat.format( "{0} occurred retrieving stack frames.", new String[] { e.toString() } ), e );
|
||||
// execution will not reach this line, as
|
||||
// #targetRequestFailed will thrown an exception
|
||||
return null;
|
||||
targetRequestFailed( e.getMessage(), null );
|
||||
}
|
||||
return new ICDIStackFrame[0];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -12,10 +12,15 @@ import java.util.Collections;
|
|||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
|
||||
import org.eclipse.cdt.debug.core.ICValue;
|
||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIValue;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable;
|
||||
import org.eclipse.cdt.debug.internal.core.CDebugUtils;
|
||||
import org.eclipse.cdt.debug.internal.core.ICDebugInternalConstants;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.debug.core.DebugException;
|
||||
import org.eclipse.debug.core.model.IValue;
|
||||
import org.eclipse.debug.core.model.IVariable;
|
||||
|
@ -79,7 +84,7 @@ public class CValue extends CDebugElement implements ICValue
|
|||
}
|
||||
catch( CDIException e )
|
||||
{
|
||||
targetRequestFailed( "Operation failed. Reason: ", e );
|
||||
logError( e );
|
||||
}
|
||||
return typeName;
|
||||
}
|
||||
|
@ -97,8 +102,8 @@ public class CValue extends CDebugElement implements ICValue
|
|||
}
|
||||
catch( CDIException e )
|
||||
{
|
||||
// change this
|
||||
requestFailed( "", e );
|
||||
logError( e );
|
||||
fValueString = e.getMessage();
|
||||
}
|
||||
}
|
||||
return fValueString;
|
||||
|
@ -160,7 +165,7 @@ public class CValue extends CDebugElement implements ICValue
|
|||
}
|
||||
catch( CDIException e )
|
||||
{
|
||||
targetRequestFailed( "Operation failed. Reason: ", e );
|
||||
targetRequestFailed( e.getMessage(), null );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -175,25 +180,27 @@ public class CValue extends CDebugElement implements ICValue
|
|||
|
||||
protected List getCDIVariables() throws DebugException
|
||||
{
|
||||
ICDIVariable[] vars = null;
|
||||
try
|
||||
{
|
||||
ICDIValue value = getUnderlyingValue();
|
||||
if ( value != null )
|
||||
{
|
||||
ICDIVariable[] vars = value.getVariables();
|
||||
//Should throw an exception
|
||||
vars = value.getVariables();
|
||||
// Quick fix.
|
||||
// getVariables should return an empty array instead of null.
|
||||
if ( vars == null )
|
||||
{
|
||||
vars = new ICDIVariable[0];
|
||||
}
|
||||
return Arrays.asList( vars );
|
||||
}
|
||||
}
|
||||
catch( CDIException e )
|
||||
{
|
||||
targetRequestFailed( "Operation failed. Reason: ", e );
|
||||
vars = new ICDIVariable[0];
|
||||
infoMessage( e );
|
||||
}
|
||||
return Collections.EMPTY_LIST;
|
||||
return Arrays.asList( vars );
|
||||
}
|
||||
|
||||
protected void calculateType( String stringValue )
|
||||
|
@ -241,7 +248,7 @@ public class CValue extends CDebugElement implements ICValue
|
|||
}
|
||||
catch( CDIException e )
|
||||
{
|
||||
targetRequestFailed( "Operation failed. Reason: ", e );
|
||||
targetRequestFailed( e.getMessage(), null );
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -163,11 +163,9 @@ public abstract class CVariable extends CDebugElement
|
|||
}
|
||||
catch( CDIException e )
|
||||
{
|
||||
targetRequestFailed( MessageFormat.format( "{0} occurred retrieving value.", new String[] { e.toString() } ), e );
|
||||
// execution will not reach this line, as
|
||||
// #targetRequestFailed will throw an exception
|
||||
return null;
|
||||
targetRequestFailed( e.toString(), null );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue