From a5f653f5696e5599aec29871c2e4f9a074c184cd Mon Sep 17 00:00:00 2001 From: onyx-and-iris <75868496+onyx-and-iris@users.noreply.github.com> Date: Sun, 18 Sep 2022 20:57:59 +0100 Subject: [PATCH] add error message if config not found --- examples/obs/main.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/examples/obs/main.go b/examples/obs/main.go index 6f593ee..c771003 100644 --- a/examples/obs/main.go +++ b/examples/obs/main.go @@ -3,8 +3,8 @@ package main import ( "fmt" "log" - "time" "os" + "time" "github.com/onyx-and-iris/voicemeeter-api-go" @@ -92,12 +92,12 @@ func vmConnect() (*voicemeeter.Remote, error) { return vm, nil } -func obsConnect() (*goobs.Client, error) { +func obsConnect() (*goobs.Client, error) { type ( connection struct { - Host string - Port int - Password string + Host string + Port int + Password string } config struct { @@ -107,7 +107,8 @@ func obsConnect() (*goobs.Client, error) { f := "config.toml" if _, err := os.Stat(f); err != nil { - f = "./config.toml" + err := fmt.Errorf("unable to locate %s", f) + return nil, err } var c config