errors.Format

This commit is contained in:
Darien Raymond
2016-12-15 11:05:32 +01:00
parent 49202930ff
commit 5bbbdc05de
6 changed files with 15 additions and 11 deletions
+2 -3
View File
@@ -2,7 +2,6 @@ package conf
import (
"encoding/json"
"fmt"
"io/ioutil"
"strings"
@@ -46,14 +45,14 @@ func (v *KCPConfig) Build() (*loader.TypedSettings, error) {
if v.Mtu != nil {
mtu := *v.Mtu
if mtu < 576 || mtu > 1460 {
return nil, fmt.Errorf("KCP|Config: Invalid MTU size: %d", mtu)
return nil, errors.Format("KCP|Config: Invalid MTU size: %d", mtu)
}
config.Mtu = &kcp.MTU{Value: mtu}
}
if v.Tti != nil {
tti := *v.Tti
if tti < 10 || tti > 100 {
return nil, fmt.Errorf("KCP|Config: Invalid TTI: %d", tti)
return nil, errors.Format("KCP|Config: Invalid TTI: %d", tti)
}
config.Tti = &kcp.TTI{Value: tti}
}
+2 -1
View File
@@ -14,6 +14,7 @@ import (
"strings"
"v2ray.com/core/app/router"
"v2ray.com/core/common/errors"
"v2ray.com/core/tools/geoip"
"github.com/golang/protobuf/proto"
@@ -29,7 +30,7 @@ func main() {
panic(err)
}
if resp.StatusCode != 200 {
panic(fmt.Errorf("Unexpected status %d", resp.StatusCode))
panic(errors.Format("Unexpected status %d", resp.StatusCode))
}
defer resp.Body.Close()
scanner := bufio.NewScanner(resp.Body)