mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-19 21:21:39 +02:00
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
This commit is contained in:
@@ -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 {
|
||||
|
Reference in New Issue
Block a user