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

Unified Diff: go/src/infra/libs/errors/errors.go

Issue 1153883002: go: infra/libs/* now live in luci-go. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: move the rest too Created 5 years, 7 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 | « go/src/infra/libs/bit_field/bf_test.go ('k') | go/src/infra/libs/errors/errors_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: go/src/infra/libs/errors/errors.go
diff --git a/go/src/infra/libs/errors/errors.go b/go/src/infra/libs/errors/errors.go
deleted file mode 100644
index 3deb920326171543e6b5bda57141516d01e60c5b..0000000000000000000000000000000000000000
--- a/go/src/infra/libs/errors/errors.go
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package errors
-
-import (
- "fmt"
- "path/filepath"
- "runtime"
-)
-
-// MarkedError is the specific error type retuned by MakeMarkFn. It's designed
-// so that you can access the underlying object if needed.
-type MarkedError struct {
- // Orig contains the original data (error or otherwise) which was passed to
- // the marker function.
- Orig interface{}
-
- msgFmt string
-}
-
-func (te *MarkedError) Error() string {
- return fmt.Sprintf(te.msgFmt, te.Orig)
-}
-
-// MakeMarkFn returns a new 'marker' function for your library. The name parameter
-// should probably match your package name, but it can by any string which
-// will help identify the error as originating from your package.
-func MakeMarkFn(name string) func(interface{}) error {
- fmtstring1 := name + " - %s:%d - %%+v"
- fmtstring2 := name + " - %+v"
- return func(errish interface{}) error {
- if errish == nil {
- return nil
- }
- _, filename, line, gotInfo := runtime.Caller(1)
- pfx := fmtstring2
- if gotInfo {
- pfx = fmt.Sprintf(fmtstring1, filepath.Base(filename), line)
- }
- return &MarkedError{errish, pfx}
- }
-}
« no previous file with comments | « go/src/infra/libs/bit_field/bf_test.go ('k') | go/src/infra/libs/errors/errors_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698