mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-03-03 17:03:10 -06:00
Fix Unmarshal issue
This commit is contained in:
parent
cf7da88327
commit
d2abb0c121
|
|
@ -24,7 +24,7 @@ import (
|
||||||
"net/url"
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
opentracing "github.com/opentracing/opentracing-go"
|
"github.com/opentracing/opentracing-go"
|
||||||
"github.com/opentracing/opentracing-go/ext"
|
"github.com/opentracing/opentracing-go/ext"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -81,8 +81,8 @@ func PostJSON[reqtype, restype any, errtype error](
|
||||||
return fmt.Errorf("HTTP %d from %s (no response body)", res.StatusCode, apiURL)
|
return fmt.Errorf("HTTP %d from %s (no response body)", res.StatusCode, apiURL)
|
||||||
}
|
}
|
||||||
var reserr errtype
|
var reserr errtype
|
||||||
if err = json.Unmarshal(body, reserr); err != nil {
|
if err = json.Unmarshal(body, &reserr); err != nil {
|
||||||
return fmt.Errorf("HTTP %d from %s", res.StatusCode, apiURL)
|
return fmt.Errorf("HTTP %d from %s - %w", res.StatusCode, apiURL, err)
|
||||||
}
|
}
|
||||||
return reserr
|
return reserr
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue