MULTI_FILE_PROVEN_OK

This commit is contained in:
Bel LaPointe
2023-10-24 13:08:23 -06:00
parent 882854f8b5
commit 94514b9128
4 changed files with 105 additions and 59 deletions

View File

@@ -196,15 +196,18 @@ func readTransactionAccount(r *bufio.Reader) (string, float64, string, error) {
b := bytes.TrimLeft(fields[1], "$")
value, err := strconv.ParseFloat(string(b), 64)
if err != nil {
return "", 0, "", err
return "", 0, "", fmt.Errorf("failed to parse value from $XX.YY from %q (%q): %w", line, fields[1], err)
}
return string(fields[0]), value, string(USD), nil
case 3: // 00.00 XYZ
value, err := strconv.ParseFloat(string(fields[2]), 64)
value, err := strconv.ParseFloat(string(fields[1]), 64)
if err != nil {
return "", 0, "", err
return "", 0, "", fmt.Errorf("failed to parse value from XX.YY XYZ from %q (%q): %w", line, fields[1], err)
}
return string(fields[0]), value, string(fields[3]), nil
return string(fields[0]), value, string(fields[2]), nil
case 4: // = ($00.00 OR 00.00 XYZ)
//return "", 0, "", fmt.Errorf("not impl: %q", line)
return string(fields[0]), 0.01, string(USD), nil
default:
return "", 0, "", fmt.Errorf("cannot interpret %q", line)
}