Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using Docfx.Common;
using Esprima;
using Jint.Runtime;

namespace Docfx.Build.Engine;

Expand Down Expand Up @@ -71,9 +72,13 @@ public object TransformModel(object model)
{
return lease.Resource.TransformModel(model);
}
catch (Exception e)
catch (Exception ex)
{
throw new InvalidPreprocessorException($"Error running Transform function inside template preprocessor: {e.Message}");
string message = ex is JavaScriptException jsException
? jsException.GetJavaScriptErrorString()
: ex.Message;

throw new InvalidPreprocessorException($"Error running Transform function inside template preprocessor: {message}");
}
}
}