/// <reference name="MicrosoftAjax.js"/>
Error.nonPositive = function(value) {
  var displayMessage = "Wyjątek NonPositive: " + value;
  var e = Error.create(displayMessage, 
    {"name": "NonPositive" }
  );
  e.popStackFrame();
  return e; 
}

function runTest(value) {
  try {
    if (value < 0) {
      throw Error.nonPositive(value);
    }
  } 
  catch (e) {
    if (e.name === "NonPositive") {
      alert (e);
    }
  }
}

runTest(-2);
runTest(2);