alpacahq / alpacahq/alpaca-trade-api-go

Return actual error types instead of generic + string

Offen
#269 0 Kommentare 2 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Go
Sterne
429
Forks
118
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

idiomatic go suggests you should pass an specific error type instead of just a string. For example, if i query for a ticker position and dont have one, you should return `ErrPositionNotExist`, not a string.

example, return something like this: `var ErrPositionNotExistForTicker = errors.New("position does not exist")`

then i can check with `error.Is()`

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.