Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-unixfs
Commits
95b0dd29
Commit
95b0dd29
authored
10 years ago
by
Matt Bell
Committed by
Juan Batiz-Benet
10 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commands: Added an Error struct for creating marshallable errors
parent
d1595ce3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
0 deletions
+10
-0
commands/response.go
commands/response.go
+10
-0
No files found.
commands/response.go
View file @
95b0dd29
...
...
@@ -7,6 +7,12 @@ const (
// TODO: add more types of errors for better error-specific handling
)
// Error is a struct for marshalling errors
type
Error
struct
{
message
string
code
ErrorType
}
type
Response
struct
{
req
*
Request
Error
error
...
...
@@ -19,6 +25,10 @@ func (r *Response) SetError(err error, errType ErrorType) {
r
.
ErrorType
=
errType
}
func
(
r
*
Response
)
FormatError
()
Error
{
return
Error
{
r
.
Error
.
Error
(),
r
.
ErrorType
}
}
/*func (r *Response) Encode() ([]byte, error) {
}*/
This diff is collapsed.
Click to expand it.
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