var RIS = RIS || {};

// This class contains the customized error class.

PWC.ApplicationError = (function () {
    'use strict';

    var applicationError = function () {
        var tmp = Error.prototype.constructor.apply(this, arguments);
        this.message = tmp.message;
        this.name = "PWC.ApplicationError";

        // Generate stack trace, for now Firefox and Chrome support it, but IE not.
        var err = new Error();
        if (err.stack) {
            this.stack = err.stack;
        }

        //we should define how our toString function works as this will be used internally
        //by the browser's stack trace generation function
        this.toString = function () {
            return this.name + ': ' + this.message;
        };

        return this;
    }
    applicationError.prototype = new Error();
    applicationError.prototype.constructor = applicationError;

    return applicationError;
})();

PWC.ServiceError = (function () {
    'use strict';

    var serviceError = function () {
        var tmp = PWC.ApplicationError.prototype.constructor.apply(this, arguments);
        this.message = tmp.message;
        this.name = "PWC.ServiceError";
        return this;
    }
    serviceError.prototype = new PWC.ApplicationError();
    serviceError.prototype.constructor = PWC.ServiceError;

    return serviceError;
})();