presto-main/src/main/java/io/prestosql/operator/scalar/FailureFunction.java/FailureFunction/failWithException
class FailureFunction:    @Description("Decodes json to an exception and throws it")
    @ScalarFunction(value = "fail", hidden = true)
    @SqlType("unknown")
    public static boolean failWithException(@SqlType(StandardTypes.JSON) Slice failureInfoSlice)
    {
        FailureInfo failureInfo = JSON_CODEC.fromJson(failureInfoSlice.getBytes());
        // wrap the failure in a new exception to append the current stack trace
        throw new PrestoException(StandardErrorCode.GENERIC_USER_ERROR, failureInfo.toException());
    }