c# - How to catch InvalidReference error in NVelocity -


I am using the library on codeplex NVelocity and on the error when I execute No parameters were found in the Evalute method and template text on VelocityEngine example.

How do I get this?

I know that in the IInvalidReferenceEventHandler interface, I did not get any information about using it in the NVelocity .App.Event namespace I would appreciate any kind of gratitude.

I have found a solution.

I created EventHandler class:

  Public category NVelocityEventHandler: IInvalidReferenceEventHandler, IMethodExceptionEventHandler {#region IInvalidReferenceEventHandler member public object invalid GetMethod (NVelocity.Context.IContext reference, string reference, object Object_Renamed, string property, NVelocity.Util.Introspection.Info information) {return "invalidGet method:" + reference; } Public Object Invalid Mode (NVelocity.Context.IContext Reference, String Context, Object Object_Renamed, String Method, NVelocity.Util.Introspection.Info Information) {Return "Invalid Method:" + Reference; } Public Child Invalid SetMethod (NVelocity.Context.IContext Reference, String Bareference, String Writherapher, Envelocity.out.Interposition.INFO Information) {Return Truth; } #thendian #thirdthationemptioneventhelter member member object emetextide eventhandler.mathexception (typeclose, string method, exception e) {return "method exception:" + method; } #endregion}  

Then I use it in the code below:

  Stringwriters Writer = New String Writer (); NVelocity.App.VelocityEngineEng = New NVellocity.App.VelocityEngine (); {Try NVelocityEventHandler te = new NVelocityEventHandler (); EventCartridge ec = new eventcarties (); Ec.AddEventHandler (te); VelocityContext vc = New VelocityContext ((dictionary)) parameter; Ec.AttachToContext (VC); Ing Evaluation (VC, author, "templateattstrument", template); } Hold (Parsair Exception pay) {return pay. message; } Hold (method invocation exception mi) {return mi.Message; }  

Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -