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:
parent
8f1cf63bd3
commit
9e95182afa
@ -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()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user