diff --git a/commands/response.go b/commands/response.go
index 85ce76fee01f1e73502395e7ef498aa69fd9a241..07e91d12ff2e31d007fb4c3c052d786c7debcb8a 100644
--- a/commands/response.go
+++ b/commands/response.go
@@ -16,8 +16,8 @@ const (
 
 // Error is a struct for marshalling errors
 type Error struct {
-  message string
-  code ErrorType
+  Message string
+  Code ErrorType
 }
 
 type EncodingType string
@@ -50,6 +50,10 @@ func (r *Response) FormatError() Error {
 }
 
 func (r *Response) Marshal() ([]byte, error) {
+  if r.Error == nil && r.Value == nil {
+    return nil, fmt.Errorf("No error or value set, there is nothing to marshal")
+  }
+
   enc := r.req.Option("enc")
   if enc == nil {
     return nil, fmt.Errorf("No encoding type was specified")
@@ -61,5 +65,10 @@ func (r *Response) Marshal() ([]byte, error) {
     return nil, fmt.Errorf("No marshaller found for encoding type '%s'", enc)
   }
 
-  return marshaller(r.Value)
+  if r.Error != nil {
+    err := r.FormatError()
+    return marshaller(err)
+  } else {
+    return marshaller(r.Value)
+  }
 }