Breeze KO basic

A super basic fiddle that talks to todo.breezejs.com. Basis for later fiddle experiments.

HTML

<script src="http://cdnjs.cloudflare.com/ajax/libs/q.js/0.9.2/q.min.js"></script>
<button class="ok">Call child which returns a result</button>
<br>
<button class="error">Call child which throws an error</button>

JavaScript

var throwError;

function parentFunction() {
    return childFunction();
}

function childFunction() {
    if (throwError) throw ('Error in child');
    return 'Everything OK';
}

$("button").on('click', function () {
    throwError = $(this).hasClass('error');
    Q.fcall(parentFunction).then(function (value) {
        alert(value);
    }, function (error) {
        alert(error);
    });
});