Skip to content

Commit

Permalink
Fixed bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
pdabre12 authored and Pratik Joseph Dabre committed Feb 5, 2025
1 parent 4e20c1c commit dc3786f
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -890,8 +890,11 @@ protected Type visitGenericLiteral(GenericLiteral node, StackableAstVisitorConte
try {
type = functionAndTypeResolver.getType(parseTypeSignature(node.getType()));
}
catch (IllegalArgumentException e) {
throw new SemanticException(TYPE_MISMATCH, node, "Unknown type: " + node.getType());
catch (PrestoException e) {
if (e.getErrorCode() == UNKNOWN_TYPE.toErrorCode()) {
throw new SemanticException(TYPE_MISMATCH, node, "Unknown type: " + node.getType());
}
throw e;
}

if (!JSON.equals(type)) {
Expand All @@ -913,8 +916,11 @@ protected Type visitEnumLiteral(EnumLiteral node, StackableAstVisitorContext<Con
try {
type = functionAndTypeResolver.getType(parseTypeSignature(node.getType()));
}
catch (IllegalArgumentException e) {
throw new SemanticException(TYPE_MISMATCH, node, "Unknown type: " + node.getType());
catch (PrestoException e) {
if (e.getErrorCode() == UNKNOWN_TYPE.toErrorCode()) {
throw new SemanticException(TYPE_MISMATCH, node, "Unknown type: " + node.getType());
}
throw e;
}

return setExpressionType(node, type);
Expand Down

0 comments on commit dc3786f

Please sign in to comment.