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

Issue 2963503003: [errors] Greatly simplify common/errors package. (Closed)

Created:
3 years, 5 months ago by iannucci
Modified:
3 years, 5 months ago
Reviewers:
dnj, Vadim Sh.
CC:
chromium-reviews, infra-reviews+luci-go_chromium.org, maruel+w_chromium.org, tandrii+luci-go_chromium.org
Target Ref:
refs/heads/master
Project:
luci-go
Visibility:
Public.

Description

[errors] Greatly simplify common/errors package. Now that we have tags with values, the original concept behind the 'data' stuff in errors no longer applies. This removes the Reason().D() system and puts the format directly into errors.Annotate. So: errors.Annotate(err).Reason("foo: %(datum)s").D("datum", "value").Err() Becomes: errors.Annotate(err, "foo %s", "value").Err() This also removes a bunch of rarely-or-never-used symbols from common/errors by making them internal (particularly w.r.t. rendering an error). If we ever develop a need for them, it would be easy to bring them back. R=dnj@chromium.org, vadimsh@chromium.org BUG= Committed: https://github.com/luci/luci-go/commit/2224066a0cc0b0fa150c733a614116c87807637e

Patch Set 1 #

Patch Set 2 : privatize / remove a bunch of other symbols #

Patch Set 3 : moar simplification #

Patch Set 4 : all tests passing #

Total comments: 14

Patch Set 5 : fix nits #

Unified diffs Side-by-side diffs Delta from patch set Stats (+888 lines, -1398 lines) Patch
M appengine/datastorecache/manager.go View 1 2 4 chunks +8 lines, -11 lines 0 comments Download
M appengine/gaeauth/server/oauth.go View 1 2 1 chunk +1 line, -1 line 0 comments Download
M cipd/client/cipd/ensure/file.go View 1 2 3 chunks +5 lines, -12 lines 0 comments Download
M cipd/client/cipd/ensure/package_def.go View 1 2 1 chunk +2 lines, -8 lines 0 comments Download
M cipd/client/cipd/ensure/template.go View 2 chunks +3 lines, -5 lines 0 comments Download
M client/isolate/utils.go View 1 2 3 chunks +3 lines, -4 lines 0 comments Download
M common/config/impl/filesystem/fs.go View 1 chunk +3 lines, -6 lines 0 comments Download
M common/config/impl/filesystem/paths.go View 1 chunk +1 line, -1 line 0 comments Download
M common/config/validation/validation.go View 1 2 chunks +4 lines, -2 lines 0 comments Download
M common/data/text/stringtemplate/template.go View 2 chunks +2 lines, -6 lines 0 comments Download
M common/errors/annotate.go View 1 2 3 4 15 chunks +141 lines, -259 lines 0 comments Download
M common/errors/annotate_example_test.go View 1 2 5 chunks +20 lines, -28 lines 0 comments Download
M common/errors/annotate_test.go View 1 2 3 4 chunks +17 lines, -59 lines 0 comments Download
M common/errors/multierror.go View 1 chunk +2 lines, -5 lines 0 comments Download
M common/errors/tags.go View 1 2 3 4 6 chunks +12 lines, -12 lines 0 comments Download
M common/errors/walk.go View 1 1 chunk +0 lines, -8 lines 0 comments Download
M common/errors/walk_test.go View 1 2 2 chunks +1 line, -28 lines 0 comments Download
M common/lhttp/client.go View 1 2 2 chunks +5 lines, -6 lines 0 comments Download
M common/runtime/profiling/profiler.go View 1 2 5 chunks +6 lines, -7 lines 0 comments Download
M common/system/filesystem/filesystem.go View 1 2 7 chunks +12 lines, -26 lines 0 comments Download
M common/system/filesystem/filesystem_test.go View 1 2 1 chunk +1 line, -1 line 0 comments Download
M common/system/prober/probe.go View 1 2 2 chunks +3 lines, -7 lines 0 comments Download
M common/tsmon/config.go View 1 2 2 chunks +2 lines, -2 lines 0 comments Download
M common/tsmon/iface.go View 1 2 3 chunks +3 lines, -4 lines 0 comments Download
M deploytool/api/deploy/util.go View 1 chunk +1 line, -1 line 0 comments Download
M deploytool/cmd/luci_deploy/appengine.go View 1 2 7 chunks +10 lines, -12 lines 0 comments Download
M deploytool/cmd/luci_deploy/build.go View 1 2 5 chunks +7 lines, -8 lines 0 comments Download
M deploytool/cmd/luci_deploy/checkout.go View 1 2 21 chunks +30 lines, -38 lines 0 comments Download
M deploytool/cmd/luci_deploy/config.go View 1 2 1 chunk +1 line, -1 line 0 comments Download
M deploytool/cmd/luci_deploy/deploy.go View 1 2 9 chunks +12 lines, -15 lines 0 comments Download
M deploytool/cmd/luci_deploy/deploy_appengine.go View 1 2 22 chunks +35 lines, -44 lines 0 comments Download
M deploytool/cmd/luci_deploy/deploy_container_engine.go View 1 2 22 chunks +33 lines, -40 lines 0 comments Download
M deploytool/cmd/luci_deploy/kubernetes.go View 1 2 1 chunk +1 line, -1 line 0 comments Download
M deploytool/cmd/luci_deploy/layout.go View 1 2 35 chunks +53 lines, -72 lines 0 comments Download
M deploytool/cmd/luci_deploy/manage.go View 1 2 6 chunks +8 lines, -11 lines 0 comments Download
M deploytool/cmd/luci_deploy/param.go View 1 chunk +1 line, -1 line 0 comments Download
M deploytool/cmd/luci_deploy/path.go View 1 2 1 chunk +1 line, -1 line 0 comments Download
M deploytool/cmd/luci_deploy/staging.go View 1 2 3 chunks +4 lines, -7 lines 0 comments Download
M deploytool/cmd/luci_deploy/title.go View 1 chunk +1 line, -2 lines 0 comments Download
M deploytool/cmd/luci_deploy/tools.go View 1 2 2 chunks +3 lines, -2 lines 0 comments Download
M deploytool/cmd/luci_deploy/util.go View 1 2 4 chunks +5 lines, -6 lines 0 comments Download
M deploytool/cmd/luci_deploy/version.go View 1 2 3 chunks +5 lines, -6 lines 0 comments Download
M deploytool/cmd/luci_deploy/work.go View 1 2 6 chunks +10 lines, -10 lines 0 comments Download
M deploytool/managedfs/filesystem.go View 1 2 21 chunks +27 lines, -40 lines 0 comments Download
M deploytool/managedfs/util.go View 1 2 4 chunks +6 lines, -6 lines 0 comments Download
M dm/appengine/deps/auth.go View 1 2 3 2 chunks +3 lines, -3 lines 0 comments Download
M dm/appengine/deps/ensure_graph_data.go View 1 2 3 5 chunks +6 lines, -7 lines 0 comments Download
M dm/appengine/deps/service.go View 1 2 3 chunks +2 lines, -5 lines 0 comments Download
M dm/appengine/deps/util.go View 1 2 1 chunk +2 lines, -2 lines 0 comments Download
M dm/appengine/distributor/notify_execution.go View 1 2 1 chunk +1 line, -1 line 0 comments Download
M dm/appengine/distributor/swarming/v1/distributor.go View 1 2 3 6 chunks +8 lines, -10 lines 0 comments Download
M dm/appengine/distributor/swarming/v1/isolate.go View 1 2 2 chunks +2 lines, -5 lines 0 comments Download
M dm/appengine/mutate/add_deps.go View 1 2 3 2 chunks +2 lines, -4 lines 0 comments Download
M dm/appengine/mutate/finish_attempt.go View 1 2 3 1 chunk +1 line, -2 lines 0 comments Download
M dm/appengine/mutate/timeout_execution.go View 1 2 1 chunk +1 line, -1 line 0 comments Download
M dm/tools/dmtool/vizQuery.go View 1 1 chunk +1 line, -1 line 0 comments Download
M grpc/grpcutil/errors.go View 1 1 chunk +3 lines, -1 line 0 comments Download
M grpc/prpc/client.go View 1 2 1 chunk +1 line, -2 lines 0 comments Download
M logdog/appengine/coordinator/endpoints/logs/get.go View 1 2 3 2 chunks +2 lines, -2 lines 0 comments Download
M logdog/appengine/coordinator/service.go View 1 2 3 3 chunks +6 lines, -6 lines 0 comments Download
M logdog/client/butler/output/logdog/output.go View 1 2 1 chunk +4 lines, -4 lines 0 comments Download
M logdog/client/butler/streamserver/namedPipe_posix.go View 1 2 1 chunk +3 lines, -7 lines 0 comments Download
M logdog/client/butler/streamserver/namedPipe_windows.go View 1 2 2 chunks +3 lines, -5 lines 0 comments Download
M logdog/client/butler/streamserver/tcp.go View 1 2 2 chunks +2 lines, -8 lines 0 comments Download
M logdog/client/butlerlib/bootstrap/bootstrap.go View 1 2 1 chunk +1 line, -1 line 0 comments Download
M logdog/client/butlerlib/streamclient/tcp.go View 1 2 2 chunks +3 lines, -11 lines 0 comments Download
M logdog/client/cli/main.go View 1 2 1 chunk +1 line, -1 line 0 comments Download
M logdog/client/cli/subcommandCat.go View 1 2 2 chunks +2 lines, -4 lines 0 comments Download
M logdog/client/cli/subcommandLatest.go View 1 2 1 chunk +1 line, -1 line 0 comments Download
M logdog/client/cli/subcommandList.go View 1 2 1 chunk +1 line, -1 line 0 comments Download
M logdog/client/cli/subcommandQuery.go View 1 2 1 chunk +1 line, -1 line 0 comments Download
M logdog/client/cmd/logdog_butler/main.go View 1 2 chunks +1 line, -9 lines 0 comments Download
M logdog/client/cmd/logdog_butler/output_logdog.go View 1 2 1 chunk +1 line, -1 line 0 comments Download
M logdog/client/cmd/logdog_butler/streamserver.go View 1 chunk +1 line, -3 lines 0 comments Download
M logdog/client/cmd/logdog_butler/subcommand_run.go View 1 2 3 chunks +6 lines, -6 lines 0 comments Download
M logdog/client/cmd/logdog_butler/subcommand_stream.go View 1 2 1 chunk +1 line, -1 line 0 comments Download
M logdog/common/storage/archive/logdog_archive_test/main.go View 1 2 6 chunks +10 lines, -12 lines 0 comments Download
M logdog/common/storage/archive/storage.go View 1 2 7 chunks +9 lines, -9 lines 0 comments Download
M logdog/common/storage/bigtable/logdog_bigtable_test/main.go View 1 2 9 chunks +11 lines, -14 lines 0 comments Download
M logdog/common/storage/entry.go View 1 2 1 chunk +1 line, -1 line 0 comments Download
M logdog/common/types/streamaddr.go View 1 2 2 chunks +5 lines, -13 lines 0 comments Download
M logdog/server/archivist/archivist.go View 1 2 1 chunk +1 line, -1 line 0 comments Download
M logdog/server/service/config/poller.go View 1 2 1 chunk +1 line, -4 lines 0 comments Download
M logdog/server/service/service.go View 1 2 4 chunks +4 lines, -5 lines 0 comments Download
M luci_config/appengine/backend/datastore/ds.go View 1 2 6 chunks +8 lines, -8 lines 0 comments Download
M luci_config/appengine/backend/memcache/cache.go View 1 2 2 chunks +4 lines, -6 lines 0 comments Download
M luci_config/server/cfgclient/access/access.go View 1 2 2 chunks +3 lines, -3 lines 0 comments Download
M luci_config/server/cfgclient/backend/authority.go View 2 chunks +2 lines, -2 lines 0 comments Download
M luci_config/server/cfgclient/backend/caching/codec.go View 1 2 2 chunks +4 lines, -4 lines 0 comments Download
M luci_config/server/cfgclient/backend/caching/config.go View 1 2 10 chunks +10 lines, -10 lines 0 comments Download
M luci_config/server/cfgclient/backend/client/client.go View 1 chunk +1 line, -1 line 0 comments Download
M luci_config/server/cfgclient/backend/format/format.go View 1 2 4 chunks +8 lines, -12 lines 0 comments Download
M luci_config/server/cfgclient/backend/format/formatters.go View 1 chunk +1 line, -1 line 0 comments Download
M luci_config/server/cfgclient/backend/get_all.go View 2 chunks +2 lines, -2 lines 0 comments Download
M luci_config/server/cfgclient/resolver.go View 1 chunk +1 line, -1 line 0 comments Download
M luci_config/server/cfgclient/textproto/resolver.go View 1 2 5 chunks +14 lines, -16 lines 0 comments Download
M lucictx/lucictx.go View 1 2 2 chunks +2 lines, -2 lines 0 comments Download
M milo/build_source/raw_presentation/html.go View 1 chunk +1 line, -3 lines 0 comments Download
M milo/build_source/swarming/build.go View 1 2 3 chunks +3 lines, -3 lines 0 comments Download
M milo/build_source/swarming/buildinfo.go View 1 2 2 chunks +6 lines, -13 lines 0 comments Download
M tokenserver/appengine/impl/certconfig/rpc_fetch_crl.go View 1 chunk +2 lines, -2 lines 0 comments Download
M tokenserver/appengine/impl/utils/policy/policy.go View 1 2 9 chunks +9 lines, -11 lines 0 comments Download
M tools/cmd/gorun/main.go View 1 2 4 chunks +7 lines, -5 lines 0 comments Download
M vpython/application/application.go View 1 2 3 7 chunks +8 lines, -12 lines 0 comments Download
M vpython/application/probe.go View 1 2 2 chunks +2 lines, -4 lines 0 comments Download
M vpython/application/subcommand_delete.go View 1 chunk +1 line, -3 lines 0 comments Download
M vpython/application/subcommand_install.go View 1 2 1 chunk +1 line, -1 line 0 comments Download
M vpython/application/subcommand_verify.go View 1 2 2 chunks +2 lines, -2 lines 0 comments Download
M vpython/cipd/cipd.go View 1 2 7 chunks +7 lines, -12 lines 0 comments Download
M vpython/options.go View 1 2 6 chunks +10 lines, -20 lines 0 comments Download
M vpython/python/find.go View 1 2 3 chunks +4 lines, -12 lines 0 comments Download
M vpython/python/interpreter.go View 1 2 4 chunks +6 lines, -13 lines 0 comments Download
M vpython/python/python.go View 2 chunks +2 lines, -5 lines 0 comments Download
M vpython/python/version.go View 1 2 2 chunks +5 lines, -9 lines 0 comments Download
M vpython/run.go View 1 2 4 chunks +5 lines, -5 lines 0 comments Download
M vpython/spec/load.go View 1 2 10 chunks +10 lines, -22 lines 0 comments Download
M vpython/spec/spec.go View 1 chunk +1 line, -3 lines 0 comments Download
M vpython/venv/config.go View 1 2 8 chunks +15 lines, -29 lines 0 comments Download
M vpython/venv/iterator.go View 1 2 2 chunks +2 lines, -6 lines 0 comments Download
M vpython/venv/prune.go View 1 2 1 chunk +2 lines, -4 lines 0 comments Download
M vpython/venv/system_posix.go View 1 2 1 chunk +2 lines, -2 lines 0 comments Download
M vpython/venv/system_windows.go View 1 2 1 chunk +2 lines, -2 lines 0 comments Download
M vpython/venv/util.go View 1 2 1 chunk +3 lines, -3 lines 0 comments Download
M vpython/venv/venv.go View 1 2 27 chunks +46 lines, -57 lines 0 comments Download
M vpython/venv/venv_resources_test.go View 1 2 14 chunks +26 lines, -40 lines 0 comments Download
M vpython/venv/venv_test.go View 1 2 1 chunk +2 lines, -2 lines 0 comments Download
M vpython/wheel/wheel.go View 1 2 6 chunks +10 lines, -18 lines 0 comments Download

Messages

Total messages: 23 (18 generated)
iannucci
3 years, 5 months ago (2017-06-28 02:58:14 UTC) #1
iannucci
On 2017/06/28 02:58:14, iannucci wrote: Oh, rietveld, y u so dum?
3 years, 5 months ago (2017-06-28 03:15:19 UTC) #6
Vadim Sh.
lgtm with minor comments main one is about non-determinist of tags map traversal https://codereview.chromium.org/2963503003/diff/60001/common/errors/annotate.go File ...
3 years, 5 months ago (2017-06-29 02:08:31 UTC) #20
iannucci
Committed patchset #5 (id:80001) manually as 2224066a0cc0b0fa150c733a614116c87807637e (presubmit successful).
3 years, 5 months ago (2017-06-29 23:21:50 UTC) #22
iannucci
3 years, 5 months ago (2017-06-29 23:22:51 UTC) #23
Message was sent while issue was closed.
https://codereview.chromium.org/2963503003/diff/60001/common/errors/annotate.go
File common/errors/annotate.go (right):

https://codereview.chromium.org/2963503003/diff/60001/common/errors/annotate....
common/errors/annotate.go:96: //  I am an internal reson formatted with key1:
value
On 2017/06/29 02:08:31, Vadim Sh. wrote:
> typo: 'reason'
> 
> also, is this comment still up-to-date?

not really, going to make a followup CL which further simplifies this
implementation.

https://codereview.chromium.org/2963503003/diff/60001/common/errors/annotate....
common/errors/annotate.go:119: for key, val := range s.tags {
On 2017/06/29 02:08:31, Vadim Sh. wrote:
> we probably want to sort tags for consistent output. Getting visually
different
> error messages for same error is frustrating.

Done.

https://codereview.chromium.org/2963503003/diff/60001/common/errors/annotate....
common/errors/annotate.go:219: func Log(c context.Context, err error,
excludePkgs ...string) {
On 2017/06/29 02:08:31, Vadim Sh. wrote:
> is 'excludePkgs' feature used outside of unit tests for this module? I propose
> to axe it. Or make excluded packages global variable populated during init
time.
> 
> Mostly because errors.Log(c, err, "luci-go/stuff1", "luci-go/stuff2") looks
> weird.

followup, but yes, it can still be used.

https://codereview.chromium.org/2963503003/diff/60001/common/errors/annotate....
common/errors/annotate.go:251: func (r *renderedFrame) DumpWrappersTo(w
io.Writer, from, to int) (n int, err error) {
On 2017/06/29 02:08:31, Vadim Sh. wrote:
> is DumpWrappersTo part of some interface?
> 
> If not, better call it dumpWrappersTo

done

https://codereview.chromium.org/2963503003/diff/60001/common/errors/annotate....
common/errors/annotate.go:362: // renderedError is a series of RenderedStacks,
one for each goroutine that the
On 2017/06/29 02:08:31, Vadim Sh. wrote:
> tbh, I don't understand why we want to keep rendered errors in such richly
> structured form instead of rendering them directly to string buffers.

yeah we don't I'll do this in a followup

https://codereview.chromium.org/2963503003/diff/60001/common/errors/annotate....
common/errors/annotate.go:501: // see the text in the 'reason' field here. To
only attach an internal reason,
On 2017/06/29 02:08:31, Vadim Sh. wrote:
> how do you choose when to use ' and when ` ? :) This comment uses both
'reason'
> and `reason` without any apparent logic.

Done.

Powered by Google App Engine
This is Rietveld 408576698