alpacahq / alpaca-trade-api-go

Go client for Alpaca's trade API
Apache License 2.0
328 stars 93 forks source link

Return actual error types instead of generic + string #269

Open drewmullen opened 10 months ago

drewmullen commented 10 months ago

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()