Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Epic - [Part 2]: refactored filters and errors #34

Merged
merged 1 commit into from
Aug 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,6 @@ import (
"time"
)

// StatusCodeError is the error given if a request's status code is not 200
type StatusCodeError string

func (err StatusCodeError) Error() string {
return string(err)
}

// NoStocksMatchedQueryError is the error given if a screen returns no results
type NoStocksMatchedQueryError string

func (err NoStocksMatchedQueryError) Error() string {
return string(err)
}

// NewClient generates a new client instance
func NewClient() *http.Client {
return &http.Client{
Expand Down
62 changes: 62 additions & 0 deletions errors.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// Copyright (c) 2020 James Bury. All rights reserved.
// Project site: https://github.com/d3an/finviz
// Use of this source code is governed by a MIT-style license that
// can be found in the LICENSE file for the project.

package finviz

// SignalNotFoundError is the error thrown if a query string is not found in the SignalLookup dict
type SignalNotFoundError string

func (err SignalNotFoundError) Error() string {
return string(err)
}

// SpecificOrderNotFoundError is the error thrown if a query string is not found in the SpecificOrderLookup dict
type SpecificOrderNotFoundError string

func (err SpecificOrderNotFoundError) Error() string {
return string(err)
}

// MultipleValuesError is the error thrown if an unsupported filter is initialized with multiple values
type MultipleValuesError string

func (err MultipleValuesError) Error() string {
return string(err)
}

// NoValuesError is the error thrown if a filter is initialized with no values
type NoValuesError string

func (err NoValuesError) Error() string {
return string(err)
}

// DuplicateFilterError is the error thrown if the same filter is declared more than once
type DuplicateFilterError string

func (err DuplicateFilterError) Error() string {
return string(err)
}

// FilterNotFoundError is the error thrown if a query string is not found in the FilterLookup dict
type FilterNotFoundError string

func (err FilterNotFoundError) Error() string {
return string(err)
}

// StatusCodeError is the error given if a request's status code is not 200
type StatusCodeError string

func (err StatusCodeError) Error() string {
return string(err)
}

// NoStocksMatchedQueryError is the error given if a screen returns no results
type NoStocksMatchedQueryError string

func (err NoStocksMatchedQueryError) Error() string {
return string(err)
}
Loading