I have an IIS REST service application that, when an exception is raised, does not seem to show me the whole call stack. Also, I don’t get line numbers. I think the line numbers are not there because the Publish doesn’t output any PDB files. Is there an option to output the PDBs when publishing, or do I have to do a separate copy operation?
Also why is the call stack not complete. I might be 5 methods deep and the stack only shows me 2.
I’m GUESSING that the short stack is because I have a catch block that catches the error and logs it and then does another RAISE statement and that raise generates its own stack. How can I log the error AND keep the stack trace ok? It seems like I need something like a “reraise” to reraise the original exception. I don’t seem to know how to do that?
Here is a code example that I THOUGHT was reraising the current exception:
except
on E : Exception do begin
result.Error.Message := E.Message;
result.Error := new VSDSError;
result.Error.StackTrace := E.StackTrace;
result.Error.InnerException := E.InnerException;
EventLog.WriteEntry( 'VsdsRest',
'Message: ' + result.Error.Message + Environment.NewLine + Environment.NewLine +
'StackTrace: ' + result.Error.StackTrace + Environment.NewLine + Environment.NewLine +
'InnerException: ' + result.Error.InnerException:ToString,
EventLogEntryType.Error,
65535 );
raise;
end;
end;
Any clues?
… time passes …
I think, answering part of my own question, in the stack of calls, there was a place where the exception catch did NOT issue the raise. So that lost part of the call stack.
I would still like to know how to PUBLISH with PDBs. If such a thing exists.