Comments (5)
At @broady you mean this
golang-samples/docs/error-reporting/fluent/main.go
Lines 55 to 69 in be19f2b
IMHO it suffices and doesn't need removing to use panic, because it shows the user how to capture the stacktrace for their bug report. What do you think?
from golang-samples.
Yep, that one.
I guess it's fine, but I don't fully understand the usage of error reporting for Go. Do we really want people to only use it for panics?
/cc @rakyll
from golang-samples.
There's a package that may simplify the code a little; github.com/pkg/errors
Thus
import (
"github.com/pkg/errors"
)
...
// Handler for the incoming requests.
func demoHandler(w http.ResponseWriter, r *http.Request) {
err := errors.Error("Runtime Issue with demoHandler")
if err != nil {
report(err, r)
}
}
func report(err Error, r *http.Request) {
...
"stacktrace": errors.Errorf("%+v", err)
...
}
I'm not sure, though, how helpful stack traces are as Rob Pike has written that errors should be given context before before bubbled up the stack or dealt with without causing the system to fall over. Using the errors pkg we could now wrap one error context within another potentially creating a much nicer and helpful error message rather than a stack trace (remembers screens full of java stack traces....!) Just my two pennies.
from golang-samples.
@broady @odeke-em I haven't seen any feedback about this. Do you still have ideas about how to improve it, or should we close this?
@Brotherhod Thanks for the link and example. I'd prefer to avoid using any additional external dependencies.
from golang-samples.
Declaring issue bankruptcy on this. Feel free to reopen if you want to fix it.
from golang-samples.
Related Issues (20)
- run/testing: TestEditorService failed HOT 1
- github.com/GoogleCloudPlatform/golang-samples: TestBadFiles failed HOT 1
- dlp/snippets/inspect: TestInspectBigQueryTableWithSampling failed HOT 1
- monitoring/snippets: TestCreateCustomMetric failed HOT 1
- monitoring/snippets: TestDeleteMetric failed HOT 1
- Checksum prevents startup script from installing the my-app.service into /etc/systemd/system
- storagetransfer: TestTransferFromAzure failed HOT 1
- storage/objects: TestV4SignedURL failed HOT 2
- improper fmt.Print statements causing test failures
- reconcile tidy checking and the toolchain directive HOT 1
- fix invalid module names HOT 1
- functions/tips/contexttip: TestMain failed HOT 5
- storage/service_account/hmac: TestDeleteKey failed HOT 2
- Feat: Required the support the stt_v2 apis
- aiplatform/text-predict: TestTextPredict failed HOT 1
- logging/simplelog: TestSimplelog failed HOT 1
- storagetransfer: TestQuickstart failed HOT 1
- functions/security: TestMain failed HOT 15
- media/videostitcher: TestListVodAdTagDetails failed HOT 1
- media/videostitcher: TestListLiveAdTagDetails failed HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from golang-samples.