mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-08-30 17:13:08 +08:00
修正:httperror没有正确parse错误格式
This commit is contained in:
+3
-1
@@ -128,7 +128,9 @@ getent passwd %{owner} >/dev/null || /usr/sbin/useradd -r -s /sbin/nologin -d %{
|
||||
$(for b in $EXTRA_BINS; do echo /opt/yunion/bin/$b; done)
|
||||
" > $SPEC_FILE
|
||||
|
||||
find $ROOT/root/ -type f | sed -e "s:$ROOT/root::g" >> $SPEC_FILE
|
||||
if [ -d $ROOT/root/ ]; then
|
||||
find $ROOT/root/ -type f | sed -e "s:$ROOT/root::g" >> $SPEC_FILE
|
||||
fi
|
||||
|
||||
rpmbuild --define "_topdir $BUILDROOT" -bb $SPEC_FILE
|
||||
|
||||
|
||||
@@ -229,12 +229,16 @@ func ParseJSONResponse(resp *http.Response, err error, debug bool) (http.Header,
|
||||
ce.Class = "redirect"
|
||||
return nil, nil, &ce
|
||||
} else {
|
||||
ce := JSONClientError{
|
||||
Code: resp.StatusCode,
|
||||
Details: resp.Status,
|
||||
}
|
||||
ce := JSONClientError{}
|
||||
|
||||
if jrbody == nil {
|
||||
ce.Code = resp.StatusCode
|
||||
ce.Details = resp.Status
|
||||
return nil, nil, &ce
|
||||
}
|
||||
|
||||
err = jrbody.Unmarshal(&ce)
|
||||
if len(ce.Class) > 0 && ce.Code >= 400 && len(ce.Details) > 0 {
|
||||
return nil, nil, &ce
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user