(rtnVals []reflect.Value)
| 273 | } |
| 274 | |
| 275 | func convertReturnValues(rtnVals []reflect.Value) *WebReturnType { |
| 276 | rtn := &WebReturnType{} |
| 277 | if len(rtnVals) == 0 { |
| 278 | return rtn |
| 279 | } |
| 280 | for _, val := range rtnVals { |
| 281 | if isNilable(val) && val.IsNil() { |
| 282 | continue |
| 283 | } |
| 284 | valType := val.Type() |
| 285 | if valType == errorRType { |
| 286 | rtn.Error = val.Interface().(error).Error() |
| 287 | continue |
| 288 | } |
| 289 | if valType == updatesRType { |
| 290 | // has a special MarshalJSON method |
| 291 | rtn.Updates = val.Interface().([]waveobj.WaveObjUpdate) |
| 292 | continue |
| 293 | } |
| 294 | if isSpecialWaveArgType(valType) { |
| 295 | jsonVal, err := convertSpecialForReturn(valType, val.Interface()) |
| 296 | if err != nil { |
| 297 | rtn.Error = fmt.Errorf("cannot convert special return value: %v", err).Error() |
| 298 | continue |
| 299 | } |
| 300 | rtn.Data = jsonVal |
| 301 | continue |
| 302 | } |
| 303 | rtn.Data = val.Interface() |
| 304 | } |
| 305 | if rtn.Error == "" { |
| 306 | rtn.Success = true |
| 307 | } |
| 308 | return rtn |
| 309 | } |
| 310 | |
| 311 | func webErrorRtn(err error) *WebReturnType { |
| 312 | return &WebReturnType{ |
no test coverage detected