Hello all.
I've put together a few service interceptors, so I've broken the ice as far as how to get started. But I recently discovered that one of my interceptors is causing errors. I'm pretty sure I've isolated which of the three is causing it, and it's a pretty straight-forward error (Unable to cast object of type 'System.Int32' to type 'System.String'). It got me thinking, though... Is there a way to get more detailed information about errors?
The interceptors I have are not particularly lengthy so I'm confident that I can pick through and find where I went wrong and fix it, but if it were more complex then I might have an issue. Maybe this is a basic C# thing that I haven't learned yet - should I be looking in that direction? Or is there a way to get Tessitura to give me more details? I've been able to reproduce the error in our TEST environment, and I can set the NLog to Trace or Debug there comfortably, but even that isn't giving me any specifics about where in the plugin the problem comes up. Any suggestions?
Thanks very much!Nathan
Nathan,
You can have a try catch block in your code and write to the nlog file the exception or the other details that are useful.
public static PluginData Operation(PluginData input){ try{ //Interceptor code } catch (Exception ex){ input.Logger.Log(NLog.
public static PluginData Operation(PluginData input){
try{ //Interceptor code
//Interceptor code
}
catch (Exception ex){
input.Logger.Log(NLog.
LogLevel.Error, "Plugin: " + ex.Message);
Jon
Thanks Jon, I think that's just what I'm looking for!
Out of curiosity, is there any way to display something like a line number where an error is occurring? Or is the accepted method to use try/catch combined with some intuition and trial & error?
Thanks again!
Nathan
edit: accidentally hit Post twice - oops!
The Logger can take an exception, which will provide a stack trace in the log.
input.Logger.Error(exception);
=>Ryan Creps
@Tessitura Network
From: Tessitura Technical Forum [mailto:forums-technical@tessituranetwork.com] On Behalf Of Nathan Wigham Sent: Friday, July 18, 2014 7:10 AM To: Ryan Creps Subject: Re: [Tessitura Technical Forum] Logging interceptor errors
From: Jon Ballinger <bounce-jonballinger5072@tessituranetwork.com> Sent: 7/17/2014 4:07:35 PM
try{
This message was sent automatically to you by www.tessituranetwork.com because you subscribed to the Tessitura Technical Forum. You may reply to this message to post to the Technical forum or visit the site to search, read and post to the forums. In the interest of keeping the forum posts from becoming cluttered, we encourage you to delete previous message text from your reply before sending. Thank you!