mirror of
https://github.com/aclindsa/moneygo.git
synced 2024-12-26 15:42:27 -05:00
imports: Add better error reporting
This commit is contained in:
parent
89d045a51f
commit
03b79d8c4a
@ -114,12 +114,14 @@ func ofxImportHelper(r io.Reader, w http.ResponseWriter, user *User, accountid i
|
|||||||
if split.AccountId != importedAccount.AccountId {
|
if split.AccountId != importedAccount.AccountId {
|
||||||
sqltransaction.Rollback()
|
sqltransaction.Rollback()
|
||||||
WriteError(w, 999 /*Internal Error*/)
|
WriteError(w, 999 /*Internal Error*/)
|
||||||
|
log.Print("Imported split's AccountId wasn't -1 but also didn't match the account")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
split.AccountId = account.AccountId
|
split.AccountId = account.AccountId
|
||||||
} else if split.SecurityId != -1 {
|
} else if split.SecurityId != -1 {
|
||||||
if sec, ok := securitymap[split.SecurityId]; ok {
|
if sec, ok := securitymap[split.SecurityId]; ok {
|
||||||
split.SecurityId = sec.SecurityId
|
split.SecurityId = sec.SecurityId
|
||||||
|
// TODO try to auto-match splits to existing accounts based on past transactions that look like this one
|
||||||
} else {
|
} else {
|
||||||
sqltransaction.Rollback()
|
sqltransaction.Rollback()
|
||||||
WriteError(w, 999 /*Internal Error*/)
|
WriteError(w, 999 /*Internal Error*/)
|
||||||
@ -225,6 +227,7 @@ func ofxImportHelper(r io.Reader, w http.ResponseWriter, user *User, accountid i
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
WriteError(w, 999 /*Internal Error*/)
|
WriteError(w, 999 /*Internal Error*/)
|
||||||
log.Print(err)
|
log.Print(err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -343,6 +346,7 @@ func OFXImportHandler(w http.ResponseWriter, r *http.Request, user *User, accoun
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
// TODO this could be an error talking with the OFX server...
|
// TODO this could be an error talking with the OFX server...
|
||||||
WriteError(w, 3 /*Invalid Request*/)
|
WriteError(w, 3 /*Invalid Request*/)
|
||||||
|
log.Print(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
defer response.Body.Close()
|
defer response.Body.Close()
|
||||||
@ -362,6 +366,7 @@ func OFXFileImportHandler(w http.ResponseWriter, r *http.Request, user *User, ac
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
if err == io.EOF {
|
if err == io.EOF {
|
||||||
WriteError(w, 3 /*Invalid Request*/)
|
WriteError(w, 3 /*Invalid Request*/)
|
||||||
|
log.Print("Encountered unexpected EOF")
|
||||||
} else {
|
} else {
|
||||||
WriteError(w, 999 /*Internal Error*/)
|
WriteError(w, 999 /*Internal Error*/)
|
||||||
log.Print(err)
|
log.Print(err)
|
||||||
|
Loading…
Reference in New Issue
Block a user