mirror of
https://github.com/aclindsa/ofxgo.git
synced 2024-11-22 03:30:04 -05:00
signon: Improve error messages
This commit is contained in:
parent
8f1cf63bd3
commit
9e95182afa
@ -2,6 +2,7 @@ package ofxgo
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
"github.com/aclindsa/go/src/encoding/xml"
|
"github.com/aclindsa/go/src/encoding/xml"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -39,7 +40,7 @@ func (r *SignonRequest) Valid() (bool, error) {
|
|||||||
if len(r.Language) == 0 {
|
if len(r.Language) == 0 {
|
||||||
r.Language = "ENG"
|
r.Language = "ENG"
|
||||||
} else if len(r.Language) != 3 {
|
} 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 {
|
if len(r.AppId) < 1 || len(r.AppId) > 5 {
|
||||||
return false, errors.New("SONRQ>APPID invalid length")
|
return false, errors.New("SONRQ>APPID invalid length")
|
||||||
@ -71,7 +72,7 @@ func (r *SignonResponse) Name() string {
|
|||||||
|
|
||||||
func (r *SignonResponse) Valid() (bool, error) {
|
func (r *SignonResponse) Valid() (bool, error) {
|
||||||
if len(r.Language) != 3 {
|
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()
|
return r.Status.Valid()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user