func MaybeTermsAgreementError(err error) error {
	const code = "term agreement required"
	e, ok := errgo.Cause(err).(*httpbakery.DischargeError)
	if !ok || e.Reason == nil || e.Reason.Code != code {
		return err
	}
	// Terms are guaranteed not to contain colon characters, so
	// there's no ambiguity when finding where the listed terms start.
	magicMarker := code + ":"
	index := strings.LastIndex(e.Reason.Message, magicMarker)
	if index == -1 {
		return err
	}
	return &TermAgreementRequiredError{
		Terms: strings.Fields(e.Reason.Message[index+len(magicMarker):]),
	}
}
// MaybeTermsAgreementError returns err as a *TermAgreementRequiredError
// if it has a "terms agreement required" error code, otherwise
// it returns err unchanged.
MaybeTermsAgreementError returns err as a *TermAgreementRequiredError
if it has a "terms agreement required" error code, otherwise
it returns err unchanged.
// MaybeTermsAgreementError returns err as a * TermAgreementRequiredError // if it has a " terms agreement required " error code otherwise // it returns err unchanged .
func MaybeTermsAgreementError(err error) error {
	const code = "term agreement required"
	e, ok := errgo.Cause(err).(*httpbakery.DischargeError)
	if !ok || e.Reason == nil || e.Reason.Code != code {
		return err
	}
	magicMarker := code + ":"
	index := strings.LastIndex(e.Reason.Message, magicMarker)
	if index == -1 {
		return err
	}
	return &TermAgreementRequiredError{
		Terms: strings.Fields(e.Reason.Message[index+len(magicMarker):]),
	}
}
func MaybeTermsAgreementError ( err error ) error { const code = " " e , ok := errgo . Cause ( err ) . ( * httpbakery . DischargeError ) if ! ok || e . Reason == nil || e . Reason . Code != code { return err } magicMarker := code + " " index := strings . LastIndex ( e . Reason . Message , magicMarker ) if index == - 1 { return err } return & TermAgreementRequiredError { Terms : strings . Fields ( e . Reason . Message [ index + len ( magicMarker ) : ] ) , } }
MaybeTermsAgreementError returns err as a *TermAgreementRequiredError
if it has a "terms agreement required" error code, otherwise
it returns err unchanged.
MaybeTermsAgreementError returns err as a * TermAgreementRequiredError if it has a " terms agreement required " error code otherwise it returns err unchanged .
// Terms are guaranteed not to contain colon characters, so // there's no ambiguity when finding where the listed terms start.