Skip to content

Commit

Permalink
shorten unexpected ordinal throw.
Browse files Browse the repository at this point in the history
  • Loading branch information
jpe7s committed Aug 16, 2024
1 parent 12869b6 commit fb55416
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 7 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ ext {
jsoniter = '2.11.+'

sava = '1.2.3'
sava_solana_programs = '1.0.10'
sava_anchor_src_gen = '1.1.3'
sava_solana_programs = '1.1.0'
sava_anchor_src_gen = '1.1.4'
}

subprojects {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ static MarginCalculationMode read(final byte[] _data, final int offset) {
return switch (ordinal) {
case 0 -> new Standard(_data[i] == 1);
case 1 -> Liquidation.read(_data, i);
default -> throw new IllegalStateException(java.lang.String.format("Unexpected ordinal [%d] for enum [MarginCalculationMode].", ordinal));
default -> throw new IllegalStateException(java.lang.String.format(
"Unexpected ordinal [%d] for enum [MarginCalculationMode]", ordinal
));
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ static ModifyOrderId read(final byte[] _data, final int offset) {
return switch (ordinal) {
case 0 -> new UserOrderId(_data[i] & 0xFF);
case 1 -> new OrderId(getInt32LE(_data, i));
default -> throw new IllegalStateException(java.lang.String.format("Unexpected ordinal [%d] for enum [ModifyOrderId].", ordinal));
default -> throw new IllegalStateException(java.lang.String.format(
"Unexpected ordinal [%d] for enum [ModifyOrderId]", ordinal
));
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ static PerpFulfillmentMethod read(final byte[] _data, final int offset) {
return switch (ordinal) {
case 0 -> AMM.read(_data, i);
case 1 -> Match.read(_data, i);
default -> throw new IllegalStateException(java.lang.String.format("Unexpected ordinal [%d] for enum [PerpFulfillmentMethod].", ordinal));
default -> throw new IllegalStateException(java.lang.String.format(
"Unexpected ordinal [%d] for enum [PerpFulfillmentMethod]", ordinal
));
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ static SpotFulfillmentMethod read(final byte[] _data, final int offset) {
return switch (ordinal) {
case 0 -> ExternalMarket.INSTANCE;
case 1 -> Match.read(_data, i);
default -> throw new IllegalStateException(java.lang.String.format("Unexpected ordinal [%d] for enum [SpotFulfillmentMethod].", ordinal));
default -> throw new IllegalStateException(java.lang.String.format(
"Unexpected ordinal [%d] for enum [SpotFulfillmentMethod]", ordinal
));
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ static EngineFieldValue read(final byte[] _data, final int offset) {
case 12 -> VecPubkey.read(_data, i);
case 13 -> VecU32.read(_data, i);
case 14 -> VecAcl.read(_data, i);
default -> throw new IllegalStateException(java.lang.String.format("Unexpected ordinal [%d] for enum [EngineFieldValue].", ordinal));
default -> throw new IllegalStateException(java.lang.String.format(
"Unexpected ordinal [%d] for enum [EngineFieldValue]", ordinal
));
};
}

Expand Down

0 comments on commit fb55416

Please sign in to comment.