~edwargix/axon

8d7282018a6fb09de5c59bb793014f0990980fb4 — David Florness 3 years ago d25c253
autojoin: bubble error up
1 files changed, 5 insertions(+), 11 deletions(-)

M autojoin/cmd.go
M autojoin/cmd.go => autojoin/cmd.go +5 -11
@@ 2,7 2,6 @@ package autojoin

import (
	"fmt"
	"os"

	"github.com/rwxrob/cmdtab"



@@ 19,21 18,19 @@ func init() {
		if len(args) != 0 {
			return x.UsageError()
		}
		autojoin()
		return nil
		return autojoin()
	}
}

func autojoin() {
func autojoin() error {
	data, err := shared.GetAuthInfo()
	if err != nil {
		fmt.Fprintln(os.Stderr, err)
		os.Exit(1)
		return err
	}

	client, err := mautrix.NewClient(data.Homeserver, data.UserID, data.AccessToken)
	if err != nil {
		panic(err)
		return err
	}

	syncer := client.Syncer.(*mautrix.DefaultSyncer)


@@ 58,8 55,5 @@ func autojoin() {
	})

	fmt.Println("Looking for rooms to join...")
	err = client.Sync()
	if err != nil {
		panic(err)
	}
	return client.Sync()
}