mirror of
https://github.com/beego/bee.git
synced 2024-11-25 20:10:55 +00:00
Add types error handler (log)
the usual warning not panic
This commit is contained in:
parent
31406ebe5a
commit
e8f85a57c2
17
g_docs.go
17
g_docs.go
@ -779,13 +779,22 @@ func parseObject(d *ast.Object, k string, m *swagger.Schema, realTypes *[]string
|
||||
mp.Default = res[1]
|
||||
switch realType{
|
||||
case "int","int64", "int32", "int16", "int8":
|
||||
mp.Default, _ = strconv.Atoi(res[1])
|
||||
if mp.Default, err = strconv.Atoi(res[1]); err != nil{
|
||||
ColorLog("[WARN] Invalid default value type(%s): %s\n",realType, res[1])
|
||||
}
|
||||
|
||||
case "bool":
|
||||
mp.Default, _ = strconv.ParseBool(res[1])
|
||||
if mp.Default, err = strconv.ParseBool(res[1]); err != nil{
|
||||
ColorLog("[WARN] Invalid default value type(%s): %s\n",realType, res[1])
|
||||
}
|
||||
case "float64":
|
||||
mp.Default, _ = strconv.ParseFloat(res[1], 64)
|
||||
if mp.Default, err = strconv.ParseFloat(res[1], 64); err != nil{
|
||||
ColorLog("[WARN] Invalid default value type(%s): %s\n",realType, res[1])
|
||||
}
|
||||
case "float32":
|
||||
mp.Default, _ = strconv.ParseFloat(res[1], 32)
|
||||
if mp.Default, err = strconv.ParseFloat(res[1], 32); err != nil{
|
||||
ColorLog("[WARN] Invalid default value type(%s): %s\n",realType, res[1])
|
||||
}
|
||||
default:
|
||||
mp.Default = res[1]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user