mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 01:50:38 +00:00
Use custom exception for replay creation failures
This commit is contained in:
@@ -150,7 +150,7 @@ namespace renderdocui.Code
|
||||
{
|
||||
m_Remote = StaticExports.CreateRemoteServer(hostname, 0);
|
||||
}
|
||||
catch (ApplicationException ex)
|
||||
catch (ReplayCreateException ex)
|
||||
{
|
||||
InitException = ex;
|
||||
}
|
||||
@@ -162,7 +162,7 @@ namespace renderdocui.Code
|
||||
m_Remote.ShutdownConnection();
|
||||
}
|
||||
|
||||
public ApplicationException InitException = null;
|
||||
public ReplayCreateException InitException = null;
|
||||
|
||||
public void CloseThreadSync()
|
||||
{
|
||||
@@ -295,7 +295,7 @@ namespace renderdocui.Code
|
||||
DestroyReplayRenderer(renderer);
|
||||
}
|
||||
}
|
||||
catch (ApplicationException ex)
|
||||
catch (ReplayCreateException ex)
|
||||
{
|
||||
InitException = ex;
|
||||
}
|
||||
|
||||
@@ -977,9 +977,7 @@ namespace renderdoc
|
||||
|
||||
if (rendPtr == IntPtr.Zero || ret != ReplayCreateStatus.Success)
|
||||
{
|
||||
var e = new System.ApplicationException("Failed to set up local proxy replay with remote connection");
|
||||
e.Data.Add("status", ret);
|
||||
throw e;
|
||||
throw new ReplayCreateException(ret, "Failed to set up local proxy replay with remote connection");
|
||||
}
|
||||
|
||||
return new ReplayRenderer(rendPtr);
|
||||
|
||||
@@ -29,6 +29,23 @@ using System.Text;
|
||||
|
||||
namespace renderdoc
|
||||
{
|
||||
public class ReplayCreateException : Exception
|
||||
{
|
||||
public ReplayCreateException(ReplayCreateStatus status)
|
||||
: base(String.Format("Replay creation failure: {0}", status.Str()))
|
||||
{
|
||||
Status = status;
|
||||
}
|
||||
|
||||
public ReplayCreateException(ReplayCreateStatus status, string msg)
|
||||
: base(msg)
|
||||
{
|
||||
Status = status;
|
||||
}
|
||||
|
||||
public ReplayCreateStatus Status;
|
||||
}
|
||||
|
||||
class StaticExports
|
||||
{
|
||||
[DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
|
||||
@@ -111,9 +128,7 @@ namespace renderdoc
|
||||
|
||||
if (rendPtr == IntPtr.Zero || ret != ReplayCreateStatus.Success)
|
||||
{
|
||||
var e = new System.ApplicationException("Failed to load log for local replay");
|
||||
e.Data.Add("status", ret);
|
||||
throw e;
|
||||
throw new ReplayCreateException(ret, "Failed to load log for local replay");
|
||||
}
|
||||
|
||||
return new ReplayRenderer(rendPtr);
|
||||
@@ -170,9 +185,7 @@ namespace renderdoc
|
||||
|
||||
if (rendPtr == IntPtr.Zero)
|
||||
{
|
||||
var e = new System.ApplicationException("Failed to open remote access connection");
|
||||
e.Data.Add("status", ReplayCreateStatus.UnknownError);
|
||||
throw e;
|
||||
throw new ReplayCreateException(ReplayCreateStatus.NetworkIOFailed, "Failed to open remote access connection");
|
||||
}
|
||||
|
||||
return new TargetControl(rendPtr);
|
||||
@@ -214,9 +227,7 @@ namespace renderdoc
|
||||
|
||||
if (rendPtr == IntPtr.Zero || ret != ReplayCreateStatus.Success)
|
||||
{
|
||||
var e = new System.ApplicationException("Failed to connect to remote replay host");
|
||||
e.Data.Add("status", ret);
|
||||
throw e;
|
||||
throw new ReplayCreateException(ret, "Failed to connect to remote replay host");
|
||||
}
|
||||
|
||||
return new RemoteServer(rendPtr);
|
||||
|
||||
@@ -169,7 +169,7 @@ namespace renderdocui.Windows
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ApplicationException();
|
||||
throw new ReplayCreateException(ReplayCreateStatus.NetworkIOFailed);
|
||||
}
|
||||
|
||||
while (m_Connection.Connected)
|
||||
@@ -264,7 +264,7 @@ namespace renderdocui.Windows
|
||||
ConnectionClosed();
|
||||
});
|
||||
}
|
||||
catch (ApplicationException)
|
||||
catch (ReplayCreateException)
|
||||
{
|
||||
this.BeginInvoke((MethodInvoker)delegate
|
||||
{
|
||||
|
||||
@@ -170,9 +170,12 @@ namespace renderdocui.Windows.Dialogs
|
||||
SetRemoteServerLive(node, true);
|
||||
server.ShutdownConnection();
|
||||
}
|
||||
catch (ApplicationException)
|
||||
catch (ReplayCreateException ex)
|
||||
{
|
||||
SetRemoteServerLive(node, false);
|
||||
if(ex.Status == ReplayCreateStatus.NetworkRemoteBusy)
|
||||
SetRemoteServerLive(node, true);
|
||||
else
|
||||
SetRemoteServerLive(node, false);
|
||||
}
|
||||
|
||||
StaticExports.EnumerateRemoteTargets(hostname, (UInt32 i) => {
|
||||
@@ -204,7 +207,7 @@ namespace renderdocui.Windows.Dialogs
|
||||
|
||||
conn.Shutdown();
|
||||
}
|
||||
catch (ApplicationException)
|
||||
catch (ReplayCreateException)
|
||||
{
|
||||
}
|
||||
});
|
||||
|
||||
@@ -959,7 +959,7 @@ namespace renderdocui.Windows
|
||||
// if we got this far without an exception, the server is running
|
||||
host.ServerRunning = true;
|
||||
}
|
||||
catch (ApplicationException)
|
||||
catch (ReplayCreateException)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -978,7 +978,7 @@ namespace renderdocui.Windows
|
||||
// if we got this far without an exception, the server is running
|
||||
host.ServerRunning = true;
|
||||
}
|
||||
catch (ApplicationException)
|
||||
catch (ReplayCreateException)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user