1
0
mirror of https://github.com/aclindsa/ofxgo.git synced 2024-10-30 05:20:05 -04:00

signon: Improve error messages

This commit is contained in:
Aaron Lindsay 2017-04-08 08:57:31 -04:00
parent 8f1cf63bd3
commit 9e95182afa

View File

@ -2,6 +2,7 @@ package ofxgo
import (
"errors"
"fmt"
"github.com/aclindsa/go/src/encoding/xml"
)
@ -39,7 +40,7 @@ func (r *SignonRequest) Valid() (bool, error) {
if len(r.Language) == 0 {
r.Language = "ENG"
} else if len(r.Language) != 3 {
return false, errors.New("SONRQ>LANGUAGE invalid length")
return false, fmt.Errorf("SONRQ>LANGUAGE invalid length: \"%s\"\n", r.Language)
}
if len(r.AppId) < 1 || len(r.AppId) > 5 {
return false, errors.New("SONRQ>APPID invalid length")
@ -71,7 +72,7 @@ func (r *SignonResponse) Name() string {
func (r *SignonResponse) Valid() (bool, error) {
if len(r.Language) != 3 {
return false, errors.New("SONRS>LANGUAGE invalid length: " + string(r.Language))
return false, fmt.Errorf("SONRS>LANGUAGE invalid length: \"%s\"\n", r.Language)
}
return r.Status.Valid()
}