presto-main/src/main/java/io/prestosql/util/Failures.java/Failures/toErrorCode
class Failures:    @Nullable
    private static ErrorCode toErrorCode(Throwable throwable)
    {
        requireNonNull(throwable);

        if (throwable instanceof PrestoException) {
            return ((PrestoException) throwable).getErrorCode();
        }
        if (throwable instanceof Failure && ((Failure) throwable).getErrorCode() != null) {
            return ((Failure) throwable).getErrorCode();
        }
        if (throwable instanceof ParsingException) {
            return SYNTAX_ERROR.toErrorCode();
        }
        return null;
    }