-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dont throw expcetions for number to string comparisons when not in st…
…rict mode (#305)
- Loading branch information
1 parent
0132078
commit 0fb9061
Showing
9 changed files
with
102 additions
and
12 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
src/main/java/liqp/exceptions/IncompatibleTypeComparisonException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package liqp.exceptions; | ||
|
||
public class IncompatibleTypeComparisonException extends RuntimeException { | ||
private static final long serialVersionUID = 1L; | ||
private final Object a; | ||
private final Object b; | ||
|
||
public IncompatibleTypeComparisonException(Object a, Object b) { | ||
super(); | ||
this.a = a; | ||
this.b = b; | ||
} | ||
|
||
@Override | ||
public String getMessage() { | ||
String aType = a == null ? "null" : a.getClass().getName(); | ||
String bType = b == null ? "null" : b.getClass().getName(); | ||
return "Cannot compare " + a + " with " + b + " because they are not the same type: " + aType + " vs " + bType; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters