package com.luxand.livenessrecognition;

import Luxand.FSDK;

import javax.swing.*;

public class Utils {

    public interface FSDKFunction {
        int run();
    }

    public static void checkErrorCode(final FSDKFunction function, final String name) {
        final int result = function.run();
        if (result != FSDK.FSDKE_OK) {
            JOptionPane.showMessageDialog(null, "Call to " + name + "failed with error: " + result, "FaceSDK Error", JOptionPane.ERROR_MESSAGE);
            System.exit(result);
        }
    }

}
