Skip to content
This repository has been archived by the owner on May 24, 2022. It is now read-only.

Commit

Permalink
Handle server error
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelmota committed Jan 8, 2020
1 parent a5d3c77 commit f90a9f8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ $ go get -u github.com/miguelmota/go-webhook-server/cmd/gws
Installing pre-compiled binary:

```bash
$ wget https://github.com/miguelmota/go-webhook-server/releases/download/v0.0.8/gws_0.0.8_Linux_x86_64.tar.gz
$ tar -xvzf gws_0.0.8_Linux_x86_64.tar.gz gws
$ wget https://github.com/miguelmota/go-webhook-server/releases/download/v0.0.9/gws_0.0.9_Linux_x86_64.tar.gz
$ tar -xvzf gws_0.0.9_Linux_x86_64.tar.gz gws
$ chmod +x gws
$ sudo mv gws /usr/local/bin/gws
```
Expand Down
6 changes: 5 additions & 1 deletion cmd/gws/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"flag"
"fmt"
"log"
"os"
"strconv"
Expand Down Expand Up @@ -46,5 +47,8 @@ func main() {
Method: method,
})

svr.Start()
if err := svr.Start(); err != nil {
fmt.Printf("ERROR: %s\n", err)
os.Exit(1)
}
}
4 changes: 2 additions & 2 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ func NewServer(config *Config) *Server {
}

// Start ...
func (s *Server) Start() {
func (s *Server) Start() error {
fmt.Printf("Listening on port %d\n", s.port)
http.ListenAndServe(fmt.Sprintf(":%d", s.port), s.r)
return http.ListenAndServe(fmt.Sprintf(":%d", s.port), s.r)
}

// Handler ...
Expand Down

0 comments on commit f90a9f8

Please sign in to comment.