code: func Wrap(category Category, reason Reason, err error) *Error {
  	errorCode := int(category) + int(reason)
  	if err == nil {
  		panic("Wrap needs a supplied error to initialize.")
  	}
  
  	// do not double wrap a error
  	switch err.(type) {
  	case *Error:
  		panic("Unable to wrap a wrapped error.")
  	}
  
  	switch category {
  	case CertificateError:
  		// given VerifyFailed , report the status with more detailed status code
  		// for some certificate errors we care.
  		if reason == VerifyFailed {
  			switch errorType := err.(type) {
  			case x509.CertificateInvalidError:
  				errorCode += certificateInvalid + int(errorType.Reason)
  			case x509.UnknownAuthorityError:
  				errorCode += unknownAuthority
  			}
  		}
  	case PrivateKeyError, IntermediatesError, RootError, PolicyError, DialError,
  		APIClientError, CSRError, CTError, CertStoreError, OCSPError:
  	// no-op, just use the error
  	default:
  		panic(fmt.Sprintf("Unsupported CFSSL error type: %d.",
  			category))
  	}
  
  	return &Error{ErrorCode: errorCode, Message: err.Error()}
  
  }
docs: // Wrap returns an error that contains the given error and an error code derived from
  // the given category, reason and the error. Currently, to avoid confusion, it is not
  // allowed to create an error of category Success