~juju-qa/ubuntu/xenial/juju/xenial-2.0-beta3

« back to all changes in this revision

Viewing changes to src/github.com/juju/juju/apiserver/registration.go

  • Committer: Martin Packman
  • Date: 2016-03-30 19:31:08 UTC
  • mfrom: (1.1.41)
  • Revision ID: martin.packman@canonical.com-20160330193108-h9iz3ak334uk0z5r
Merge new upstream source 2.0~beta3

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
import (
7
7
        "crypto/rand"
8
8
        "encoding/json"
9
 
        "io"
10
9
        "io/ioutil"
11
10
        "net/http"
12
11
 
14
13
        "github.com/juju/names"
15
14
        "golang.org/x/crypto/nacl/secretbox"
16
15
 
17
 
        "github.com/juju/juju/apiserver/common"
18
16
        "github.com/juju/juju/apiserver/params"
19
17
        "github.com/juju/juju/state"
20
18
)
152
150
        }
153
151
        return &payload, nil
154
152
}
155
 
 
156
 
// sendError sends a JSON-encoded error response.
157
 
func (h *registerUserHandler) sendError(w io.Writer, req *http.Request, err error) {
158
 
        if err != nil {
159
 
                logger.Errorf("returning error from %s %s: %s", req.Method, req.URL.Path, errors.Details(err))
160
 
        }
161
 
        sendJSON(w, &params.ErrorResult{Error: common.ServerError(err)})
162
 
}