Skip to content

Commit

Permalink
Adding helpful error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
lpicanco committed Nov 9, 2019
1 parent 5f1e5de commit b9cf5c6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ func init() {
data, err := ioutil.ReadFile(configFile)

if err != nil {
log.Fatalf("Error reading configuration file: %s", err)
log.Fatalf("error reading configuration file: %s", err)
}

if err := yaml.Unmarshal(data, &Config); err != nil {
log.Fatalf("Error processing configuration file %s: \n %s", configFile, err)
log.Fatalf("error processing configuration file %s: \n %s", configFile, err)
}
}

Expand Down
16 changes: 8 additions & 8 deletions display/randr.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ func init() {
var err error
xgbConn, err = xgb.NewConn()
if err != nil {
log.Fatal(err)
log.Fatalf("error initializing xgb: %v", err)
}

err = randr.Init(xgbConn)
if err != nil {
log.Fatal(err)
log.Fatalf("error initializing randr: %v", err)
}
}

Expand All @@ -41,7 +41,7 @@ func Refresh() {

currentWorkspace, err := i3.GetCurrentWorkspaceNumber()
if err != nil {
log.Fatal(err)
log.Fatalf("error getting i3 current workspace: %v", err)
}

for _, display := range config.Config.Displays {
Expand All @@ -52,7 +52,7 @@ func Refresh() {

err = i3.SetCurrentWorkspace(currentWorkspace)
if err != nil {
log.Fatal(err)
log.Fatalf("error setting i3 current workspace: %v", err)
}

lastOutputConfiguration = currentOutputConfiguration
Expand All @@ -66,13 +66,13 @@ func ListenEvents() {
randr.NotifyMaskScreenChange|randr.NotifyMaskCrtcChange|randr.NotifyMaskOutputChange).Check()

if err != nil {
log.Fatal(err)
log.Fatalf("error subscribing to randr events: %v", err)
}

for {
ev, err := xgbConn.WaitForEvent()
if err != nil {
log.Fatal(err)
log.Fatalf("error processing randr event: %v", err)
}

switch ev.(type) {
Expand Down Expand Up @@ -108,13 +108,13 @@ func getOutputConfiguration() map[string]bool {
resources, err := randr.GetScreenResources(xgbConn, root).Reply()

if err != nil {
log.Fatal(err)
log.Fatalf("error getting randr screen resources: %v", err)
}

for _, output := range resources.Outputs {
info, err := randr.GetOutputInfo(xgbConn, output, 0).Reply()
if err != nil {
log.Fatal(err)
log.Fatalf("error getting randr output info: %v", err)
}

config[string(info.Name)] = info.Connection == randr.ConnectionConnected
Expand Down

0 comments on commit b9cf5c6

Please sign in to comment.