agent/wsclient/error.go
func (err *WSError) Error() string {
	val := reflect.ValueOf(err.ErrObj)
	if val.Kind() == reflect.Ptr {
		val = val.Elem()
	}
	var typeStr = "Unknown type"
	if val.IsValid() {
		typeStr = val.Type().Name()
		msg := val.FieldByName("Message_")
		if msg.IsValid() && msg.CanInterface() {
			str, ok := msg.Interface().(*string)
			if ok {
				if str == nil {
					return typeStr + ": null"
				}
				return typeStr + ": " + *str
			}
		}
	}

	if asErr, ok := err.ErrObj.(error); ok {
		return err.Type + ": " + asErr.Error()
	}
	return err.Type + ": Unknown error (" + typeStr + ")"
}
func (err *WSError) Error() string {
	val := reflect.ValueOf(err.ErrObj)
	if val.Kind() == reflect.Ptr {
		val = val.Elem()
	}
	var typeStr = "Unknown type"
	if val.IsValid() {
		typeStr = val.Type().Name()
		msg := val.FieldByName("Message_")
		if msg.IsValid() && msg.CanInterface() {
			str, ok := msg.Interface().(*string)
			if ok {
				if str == nil {
					return typeStr + ": null"
				}
				return typeStr + ": " + *str
			}
		}
	}

	if asErr, ok := err.ErrObj.(error); ok {
		return err.Type + ": " + asErr.Error()
	}
	return err.Type + ": Unknown error (" + typeStr + ")"
}
// Error returns an error string