Skip to content

Commit c2477f7

Browse files
authored
Merge pull request #22 from pallotron/master
Actually return an error for unknown symbol
2 parents 0545f78 + 75e947a commit c2477f7

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

quote/client.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package quote
22

33
import (
44
"context"
5+
"fmt"
56
"strings"
67

78
finance "github.com/piquette/finance-go"
@@ -62,6 +63,10 @@ func GetHistoricalQuote(symbol string, month int, day int, year int) (*finance.C
6263
func Get(symbol string) (*finance.Quote, error) {
6364
i := List([]string{symbol})
6465

66+
if i.Count() == 0 {
67+
return nil, fmt.Errorf("Can't find quote for symbol: %s", symbol)
68+
}
69+
6570
if !i.Next() {
6671
return nil, i.Err()
6772
}

0 commit comments

Comments
 (0)