Skip to content

Commit e4afe4b

Browse files
committed
Minor ErrorValue refactoring for better default messages
1 parent de1a4c7 commit e4afe4b

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

convex-core/src/main/java/convex/core/lang/Context.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public CVMLong getPosition(Symbol sym) {
141141
}
142142

143143
/**
144-
* Inner class for less-frequently changing CVM state related to Actor execution
144+
* Immutable inner class for less-frequently changing CVM state
145145
* Should save some allocation / GC on average, since it will change less
146146
* frequently than the surrounding Context and can be cheaply copied by reference.
147147
*

convex-core/src/main/java/convex/core/lang/exception/ErrorValue.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,16 @@ public class ErrorValue extends AThrowable {
3838
private Address address=null;
3939

4040
static {
41-
addDefaultError(ErrorCodes.ARGUMENT,"Invalid argument value");
41+
addDefaultError(ErrorCodes.ARGUMENT,"Invalid argument");
4242
addDefaultError(ErrorCodes.NOBODY,"Account does not exist");
43+
addDefaultError(ErrorCodes.FUNDS,"Funds not available");
44+
addDefaultError(ErrorCodes.JUICE,"Out of juice");
45+
addDefaultError(ErrorCodes.CAST,"Illegal type cast");
46+
addDefaultError(ErrorCodes.ASSERT,"Assertion failed");
47+
addDefaultError(ErrorCodes.ARITY,"Wrong number of arguments");
48+
addDefaultError(ErrorCodes.BOUNDS,"Out of bounds");
49+
addDefaultError(ErrorCodes.TODO,"Not implemented");
50+
addDefaultError(ErrorCodes.MEMORY,"Out of memory");
4351
}
4452

4553
private ErrorValue(ACell code, ACell message) {

0 commit comments

Comments
 (0)