[errorprone] Exceptions should not override #toString

Instead of overriding #toString provide getter for additional
information so that code handling the exception can access it.

See https://errorprone.info/bugpattern/OverrideThrowableToString

Change-Id: Ie577ae9327e0234d55481253f2604b1644ea3f01
This commit is contained in:
Matthias Sohn 2023-09-19 16:24:48 +02:00
parent 1e92426c5a
commit 978cbb84c4
2 changed files with 8 additions and 8 deletions

View File

@ -51,9 +51,4 @@ public void setPermanent(boolean permanent) {
public boolean isPermanent() {
return permanent;
}
@Override
public String toString() {
return super.toString() + ", permanent: " + permanent; //$NON-NLS-1$
}
}

View File

@ -44,8 +44,13 @@ public RevisionSyntaxException(String message, String revstr) {
this.revstr = revstr;
}
@Override
public String toString() {
return super.toString() + ":" + revstr; //$NON-NLS-1$
/**
* Get the problematic revision string
*
* @return the problematic revision string
* @since 6.8
*/
public String getRevstr() {
return revstr;
}
}