load_class = function (class_name, module_name, registry) {
        /**
         * Tries to load a class
         *
         * Tries to load a class from a module using require.js, if a module
         * is specified, otherwise tries to load a class from the global
         * registry, if the global registry is provided.
         */
        return new Promise(function (resolve, reject) {

            // Try loading the view module using require.js
            if (module_name) {
                require([module_name], function (module) {
                    if (module[class_name] === undefined) {
                        reject(new Error('Class ' + class_name + ' not found in module ' + module_name));
                    } else {
                        resolve(module[class_name]);
                    }
                }, reject);
            } else {
                if (registry && registry[class_name]) {
                    resolve(registry[class_name]);
                } else {
                    reject(new Error('Class ' + class_name + ' not found in registry '));
                }
            }
        });
    }
Wrappable Error class

The Error class doesn't actually act on `this`.  Instead it always
returns a new instance of Error.  Here we capture that instance so we
can apply it's properties to `this`.