Skip to content

Commit

Permalink
Fix: Reporting no longer removes source position from the console output
Browse files Browse the repository at this point in the history
  • Loading branch information
Hellwig-SE committed Sep 14, 2023
1 parent a8f8521 commit 062e451
Showing 1 changed file with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,14 @@ public void doWarn(String msg) {

@Override
public void doWarn(String msg, SourcePosition position) {
this.doWarn(msg);
reportWarning(msg);
super.doWarn(msg, position);
}

@Override
public void doWarn(String msg, SourcePosition start, SourcePosition end) {
this.doWarn(msg);
reportWarning(msg);
super.doWarn(msg, start, end);
}


Expand All @@ -122,17 +124,17 @@ public void doWarn(String msg, Throwable t) {
*/
@Override
public void doError(String msg) {
this.doError(msg, Optional.empty());
_doError(msg, Optional.empty(), Optional.empty(), Optional.empty());
}

@Override
public void doError(String msg, SourcePosition position) {
this.doError(msg);
_doError(msg, Optional.empty(), Optional.ofNullable(position), Optional.empty());
}

@Override
public void doError(String msg, SourcePosition start, SourcePosition end) {
this.doError(msg);
_doError(msg, Optional.empty(), Optional.ofNullable(start), Optional.ofNullable(end));
}

/**
Expand All @@ -141,10 +143,10 @@ public void doError(String msg, SourcePosition start, SourcePosition end) {
*/
@Override
public void doError(String msg, Throwable t) {
this.doError(msg, Optional.ofNullable(t));
_doError(msg, Optional.ofNullable(t), Optional.empty(), Optional.empty());
}

protected void doError(String msg, Optional<Throwable> t) {
protected void _doError(String msg, Optional<Throwable> t, Optional<SourcePosition> start, Optional<SourcePosition> end) {
// we need to know whether we wanted to fail immediately
boolean wantsToFailQuick = Log.isFailQuickEnabled();
if (wantsToFailQuick) {
Expand All @@ -157,7 +159,11 @@ protected void doError(String msg, Optional<Throwable> t) {
if (t.isPresent()) {
super.doError(msg, t.get());
}
else {
else if(start.isPresent() && end.isPresent()){
super.doError(msg, start.get(), end.get());
} else if(start.isPresent()) {
super.doError(msg, start.get());
}else{
super.doError(msg);
}

Expand Down

0 comments on commit 062e451

Please sign in to comment.