Skip to content

Commit

Permalink
Errorhandling
Browse files Browse the repository at this point in the history
  • Loading branch information
lenilsas committed Jan 14, 2025
1 parent 0b60f64 commit c51b59a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,13 @@ else if (open instanceof Mitglied)
throw new ApplicationException(
"Mehrere Buchungen mehreren Sollbuchungen zuordnen nicht möglich!");
}
if (b[0].getSplitTyp() != null
&& (b[0].getSplitTyp() == SplitbuchungTyp.GEGEN
|| b[0].getSplitTyp() == SplitbuchungTyp.HAUPT))
{
throw new ApplicationException(
"Haupt- oder Gegen-Buchungen können nicht mehreren Sollbuchungen zugeordnet werden!");
}

b[0].transactionBegin();
Mitgliedskonto[] mks = (Mitgliedskonto[]) open;
Expand Down Expand Up @@ -187,7 +194,8 @@ else if (open instanceof Mitglied)
{
b[0].transactionRollback();
Logger.error("Fehler", e);
throw new ApplicationException("Fehler beim Splitten der Buchung.");
throw new ApplicationException(
"Fehler beim Splitten der Buchung: " + e.getLocalizedMessage());
}
}
else
Expand Down
6 changes: 3 additions & 3 deletions src/de/jost_net/JVerein/io/SplitbuchungsContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -437,11 +437,11 @@ else if (splitMap.size() > 1)
buchung.setMitgliedskontoID(null);
}
// Haupt- und Gegen-Buchungen können nicht gesplittet werden.
// Das Zuweisen zu einer Sollbuchung macht keinen sinn, daher abbrechen.
else if (buchung.getSplitTyp() == SplitbuchungTyp.GEGEN
|| buchung.getSplitTyp() == SplitbuchungTyp.HAUPT)
{
return null;
throw new ApplicationException(
"Splitten von Haupt und Gegenbuchung nicht möglich.");
}
else
{
Expand Down Expand Up @@ -534,7 +534,7 @@ else if (buchung.getSplitTyp() == SplitbuchungTyp.GEGEN
{
if (immerSplitten)
{
throw new ApplicationException("Fehler beim Splitten: ", e);
throw new ApplicationException(e.getLocalizedMessage());
}
splitten = false;
if (splitbuchungen != null)
Expand Down

0 comments on commit c51b59a

Please sign in to comment.