aboutsummaryrefslogtreecommitdiffhomepage
path: root/tpl
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2024-09-12 09:13:47 +0200
committerBjørn Erik Pedersen <[email protected]>2024-09-12 13:51:37 +0200
commit28f621d4a73ca7e97e23b33cbf3780ddab188d24 (patch)
treea4c904130ac1001af3207023aedc960f4ecce139 /tpl
parentfe7e137e28de66fb68af1089c6248b01fb318b49 (diff)
downloadhugo-28f621d4a73ca7e97e23b33cbf3780ddab188d24.tar.gz
hugo-28f621d4a73ca7e97e23b33cbf3780ddab188d24.zip
internal/warpc: Improve the JS plugin API
* Move the error handling into commons and make sure the error returned also returns message errors * Make the protocol version an int so it can be more easily compared
Diffstat (limited to 'tpl')
-rw-r--r--tpl/transform/transform.go5
1 files changed, 1 insertions, 4 deletions
diff --git a/tpl/transform/transform.go b/tpl/transform/transform.go
index 843351702..c9af141ed 100644
--- a/tpl/transform/transform.go
+++ b/tpl/transform/transform.go
@@ -235,7 +235,7 @@ func (ns *Namespace) ToMath(ctx context.Context, args ...any) (types.Result[temp
_, r, err := fileCache.GetOrCreate(key, func() (io.ReadCloser, error) {
message := warpc.Message[warpc.KatexInput]{
Header: warpc.Header{
- Version: "v1",
+ Version: 1,
ID: ns.id.Add(1),
},
Data: katexInput,
@@ -249,9 +249,6 @@ func (ns *Namespace) ToMath(ctx context.Context, args ...any) (types.Result[temp
if err != nil {
return nil, err
}
- if result.Header.Err != "" {
- return nil, errors.New(result.Header.Err)
- }
return hugio.NewReadSeekerNoOpCloserFromString(result.Data.Output), nil
})
if err != nil {