thrasher-corp / gocryptotrader

A cryptocurrency trading bot and framework supporting multiple exchanges written in Golang.
MIT License
3.02k stars 804 forks source link

common: add function ErrorWithContext #1567

Closed shazbert closed 3 months ago

shazbert commented 4 months ago

PR Description

Adds verbose output to error using runtime package information.

Please delete options that are not relevant and add an x in [] as item is complete.

How has this been tested

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration and also consider improving test coverage whilst working on a certain feature or package.

Checklist

codecov[bot] commented 4 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 36.30%. Comparing base (98f025e) to head (390406d). Report is 2 commits behind head on master.

:exclamation: Current head 390406d differs from pull request most recent head 977edd8

Please upload reports for the commit 977edd8 to get more accurate results.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/thrasher-corp/gocryptotrader/pull/1567/graphs/tree.svg?width=650&height=150&src=pr&token=41784B23TS&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=thrasher-corp)](https://app.codecov.io/gh/thrasher-corp/gocryptotrader/pull/1567?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=thrasher-corp) ```diff @@ Coverage Diff @@ ## master #1567 +/- ## ========================================== + Coverage 36.26% 36.30% +0.03% ========================================== Files 419 419 Lines 183133 183151 +18 ========================================== + Hits 66421 66488 +67 + Misses 108605 108568 -37 + Partials 8107 8095 -12 ``` | [Files](https://app.codecov.io/gh/thrasher-corp/gocryptotrader/pull/1567?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=thrasher-corp) | Coverage Δ | | |---|---|---| | [common/common.go](https://app.codecov.io/gh/thrasher-corp/gocryptotrader/pull/1567?src=pr&el=tree&filepath=common%2Fcommon.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=thrasher-corp#diff-Y29tbW9uL2NvbW1vbi5nbw==) | `95.02% <100.00%> (+1.01%)` | :arrow_up: | ... and [20 files with indirect coverage changes](https://app.codecov.io/gh/thrasher-corp/gocryptotrader/pull/1567/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=thrasher-corp)
shazbert commented 3 months ago

Opted to not introduce code that is not integrated into library and never will be. Will open a PR to assign at the logger level if the the caller functionality is needed.