Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1260)

Unified Diff: common/runtime/profiling/profiler.go

Issue 2963503003: [errors] Greatly simplify common/errors package. (Closed)
Patch Set: fix nits Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « common/lhttp/client.go ('k') | common/system/filesystem/filesystem.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: common/runtime/profiling/profiler.go
diff --git a/common/runtime/profiling/profiler.go b/common/runtime/profiling/profiler.go
index 13d210fa53cdc971f0ad871fb8c5f4f52883914d..2f31d3ae8f517fc312bd2f906516cf2f65cc49e1 100644
--- a/common/runtime/profiling/profiler.go
+++ b/common/runtime/profiling/profiler.go
@@ -95,7 +95,7 @@ func (p *Profiler) Start() error {
if p.ProfileCPU {
out, err := os.Create(p.generateOutPath("cpu"))
if err != nil {
- return errors.Annotate(err).Reason("failed to create CPU profile output file").Err()
+ return errors.Annotate(err, "failed to create CPU profile output file").Err()
}
pprof.StartCPUProfile(out)
p.profilingCPU = true
@@ -103,7 +103,7 @@ func (p *Profiler) Start() error {
if p.BindHTTP != "" {
if err := p.startHTTP(); err != nil {
- return errors.Annotate(err).Reason("failed to start HTTP server").Err()
+ return errors.Annotate(err, "failed to start HTTP server").Err()
}
}
@@ -126,8 +126,7 @@ func (p *Profiler) startHTTP() error {
// Bind to our profiling port.
l, err := net.Listen("tcp4", p.BindHTTP)
if err != nil {
- return errors.Annotate(err).Reason("failed to bind to TCP4 address: %(addr)q").
- D("addr", p.BindHTTP).Err()
+ return errors.Annotate(err, "failed to bind to TCP4 address: %q", p.BindHTTP).Err()
}
server := http.Server{
@@ -168,7 +167,7 @@ func (p *Profiler) DumpSnapshot() error {
if p.ProfileHeap {
if err := p.dumpHeapProfile(); err != nil {
- return errors.Annotate(err).Reason("failed to dump heap profile").Err()
+ return errors.Annotate(err, "failed to dump heap profile").Err()
}
}
@@ -178,14 +177,14 @@ func (p *Profiler) DumpSnapshot() error {
func (p *Profiler) dumpHeapProfile() error {
fd, err := os.Create(p.generateOutPath("memory"))
if err != nil {
- return errors.Annotate(err).Reason("failed to create output file").Err()
+ return errors.Annotate(err, "failed to create output file").Err()
}
defer fd.Close()
// Get up-to-date statistics.
runtime.GC()
if err := pprof.WriteHeapProfile(fd); err != nil {
- return errors.Annotate(err).Reason("failed to write heap profile").Err()
+ return errors.Annotate(err, "failed to write heap profile").Err()
}
return nil
}
« no previous file with comments | « common/lhttp/client.go ('k') | common/system/filesystem/filesystem.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698