recognition/recognition-aborted-exception.js


const MwRecognitionAbortedException = require("../_mwbridge/_mw-bridge").MwRecognitionAbortedException;

/**
 * Represents recognition abort exception which is thrown in timeout exceeding during recognition with BarCodeReader.
 */
class RecognitionAbortedException extends Error
{
    mwClass;

    /**
     * Gets the execution time of current recognition session
     * @return The execution time of current recognition session
     */
    getExecutionTime()
    {
        return this.mwClass.getExecutionTimeSync();
    }

    /**
     * Sets the execution time of current recognition session
     * @param value The execution time of current recognition session
     */
    setExecutionTime(value)
    {
        this.mwClass.setExecutionTimeSync(value);
    }

    /**
     * Initializes a new instance of the <see cref="RecognitionAbortedException" /> class with specified recognition abort message.
     * @param message The error message of the exception.
     * @param executionTime The execution time of current recognition session.
     */
    constructor(message, executionTime)
    {
        super(message);
        if (message != null && executionTime != null)
        {
            this.mwClass = new MwRecognitionAbortedException(message, executionTime);
        }
        else if (executionTime != null)
        {
            this.mwClass = new MwRecognitionAbortedException(executionTime);
        }
        else
        {
            this.mwClass = new MwRecognitionAbortedException();
        }
    }

    static _fromMwObject(mwObject)
    {
        let exception = new RecognitionAbortedException(null, null);
        exception.mwClass = mwObject;
        return exception;
    }

    _initializeWrapperMembers()
    {

    }
}

module.exports = RecognitionAbortedException;