Enhance auth JSONRPC, now provides persistent output

Implements

   - Auth.Generate("user")
   - Auth.Fetch("user")
   - Auth.Reset("user")

This patch also adds testing for each of these cases
This commit is contained in:
Harshavardhana
2015-09-18 02:59:57 -07:00
parent 51652c38cb
commit f8bb85aeb7
6 changed files with 222 additions and 26 deletions

View File

@@ -107,6 +107,9 @@ func (e *Error) Trace(fields ...string) *Error {
// Internal trace - records the point at which it is invoked.
func (e *Error) trace(fields ...string) *Error {
if e == nil {
return nil
}
pc, file, line, _ := runtime.Caller(2)
function := runtime.FuncForPC(pc).Name()
_, function = filepath.Split(function)
@@ -139,6 +142,9 @@ func (e *Error) Untrace() *Error {
// ToGoError returns original error message.
func (e *Error) ToGoError() error {
if e == nil || e.Cause == nil {
return nil
}
return e.Cause
}