Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go123
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go123
Commits
383fe35f
Commit
383fe35f
authored
Dec 13, 2016
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xerr: Move Errorv from exc here
It is completely orthogonal to exception handling.
parent
608a1c5a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
15 deletions
+33
-15
exc/error.go
exc/error.go
+0
-15
xerr/xerr.go
xerr/xerr.go
+33
-0
No files found.
exc/error.go
View file @
383fe35f
...
@@ -177,18 +177,3 @@ func erraddcallingcontext(topfunc string, e *Error) *Error {
...
@@ -177,18 +177,3 @@ func erraddcallingcontext(topfunc string, e *Error) *Error {
return
e
return
e
}
}
// error merging multiple errors (e.g. after collecting them from several parallel workers)
type
Errorv
[]
error
func
(
ev
Errorv
)
Error
()
string
{
if
len
(
ev
)
==
1
{
return
ev
[
0
]
.
Error
()
}
msg
:=
fmt
.
Sprintf
(
"%d errors:
\n
"
,
len
(
ev
))
for
_
,
e
:=
range
ev
{
msg
+=
fmt
.
Sprintf
(
"
\t
- %s
\n
"
,
e
)
}
return
msg
}
xerr/xerr.go
0 → 100644
View file @
383fe35f
// Copyright (C) 2015-2016 Nexedi SA and Contributors.
// Kirill Smelkov <kirr@nexedi.com>
//
// This program is free software: you can Use, Study, Modify and Redistribute
// it under the terms of the GNU General Public License version 3, or (at your
// option) any later version, as published by the Free Software Foundation.
//
// This program is distributed WITHOUT ANY WARRANTY; without even the implied
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//
// See COPYING file for full licensing terms.
// Package xerr provides addons for error-handling
package
xerr
import
(
"fmt"
)
// error merging multiple errors (e.g. after collecting them from several parallel workers)
type
Errorv
[]
error
func
(
ev
Errorv
)
Error
()
string
{
if
len
(
ev
)
==
1
{
return
ev
[
0
]
.
Error
()
}
msg
:=
fmt
.
Sprintf
(
"%d errors:
\n
"
,
len
(
ev
))
for
_
,
e
:=
range
ev
{
msg
+=
fmt
.
Sprintf
(
"
\t
- %s
\n
"
,
e
)
}
return
msg
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment