view src/implab/di/ActivationError.js @ 23:1d72fddc319a

make eslint happy
author cin
date Wed, 06 Dec 2017 14:19:45 +0300
parents fc2517695ee1
children
line wrap: on
line source

define([
    "../declare"
], function (declare) {
    return declare(null, {
        activationStack: null,

        service: null,

        innerException: null,

        message: null,

        constructor: function (service, activationStack, innerException) {
            this.message = "Failed to activate the service";
            this.activationStack = activationStack;
            this.service = service;
            this.innerException = innerException;
        },

        toString: function () {
            var parts = [this.message];
            if (this.service)
                parts.push("when activating: " + this.service.toString());

            if (this.innerException)
                parts.push("caused by: " + this.innerException.toString());

            if (this.activationStack) {
                parts.push("at");
                this.activationStack.forEach(function (x) {
                    parts.push("    " + x.name + " " +
                        (x.service ? x.service.toString() : ""));
                });
            }

            return parts.join("\n");
        }
    });
});