diff --git a/src/amd/ts/text/TemplateParser.ts b/src/amd/ts/text/TemplateParser.ts --- a/src/amd/ts/text/TemplateParser.ts +++ b/src/amd/ts/text/TemplateParser.ts @@ -66,7 +66,7 @@ export class TemplateParser implements I } value() { - if (!this._value) + if (this._value === undefined) throw new Error("The current token doesn't have a value"); return this._value; } diff --git a/src/amd/ts/text/template-compile.ts b/src/amd/ts/text/template-compile.ts --- a/src/amd/ts/text/template-compile.ts +++ b/src/amd/ts/text/template-compile.ts @@ -38,10 +38,17 @@ compile.load = (id: string, require: Req trace.debug("{0}: compiled", url); callback(cache[url] = tc); }, (err: any) => { - callback.error({ - inner: err, - src: "@implab/core/text/template-compile" - }); + if (callback.error) + callback.error({ + inner: err, + from: "@implab/core/text/template-compile" + }); + else + trace.error({ + message: `Failed to load: ${url}`, + error: err, + from: "@implab/core/text/template-compile" + }); }); } }; diff --git a/src/main/ts/di/ConfigError.ts b/src/main/ts/di/ConfigError.ts --- a/src/main/ts/di/ConfigError.ts +++ b/src/main/ts/di/ConfigError.ts @@ -1,12 +1,14 @@ -export class ConfigError extends Error { +export class ConfigError { inner?: {}; + message: string; + path?: string; configName?: string; constructor(message: string, inner?: {}) { - super(message); + this.message = message; this.inner = inner; } } diff --git a/src/main/ts/di/Configuration.ts b/src/main/ts/di/Configuration.ts --- a/src/main/ts/di/Configuration.ts +++ b/src/main/ts/di/Configuration.ts @@ -6,7 +6,7 @@ import { ILifetime, ServiceContainer } from "./interfaces"; -import { argumentNotEmptyString, isPrimitive, isPromise, delegate, argumentOfType, argumentNotNull, get, primitive } from "../safe"; +import { argumentNotEmptyString, isPrimitive, isPromise, delegate, argumentOfType, argumentNotNull, get, primitive, oid, mixin } from "../safe"; import { AggregateDescriptor } from "./AggregateDescriptor"; import { ValueDescriptor } from "./ValueDescriptor"; import { ReferenceDescriptor } from "./ReferenceDescriptor"; @@ -20,6 +20,7 @@ import { ICancellation } from "../interf import { isDescriptor } from "./traits"; import { LazyReferenceDescriptor } from "./LazyReferenceDescriptor"; import { LifetimeManager } from "./LifetimeManager"; +import { ServiceDescriptorParams } from "./ServiceDescriptor"; export interface RegistrationScope { @@ -339,8 +340,8 @@ export class Configuration) { - const opts: any = { - }; + const opts: any = {}; + if (data.services) opts.services = this._visitRegistrations(data.services, "services"); @@ -361,7 +362,7 @@ export class Configuration( await mapAll(opts) ); @@ -420,6 +426,9 @@ export class Configurationthis в cb. * @returns {void} */ -export function each(obj: T, cb: (v: NonNullable, k: X) => void): void; +export function each(obj: T, cb: >(v: NonNullable, k: X) => void): void; export function each(array: T[], cb: (v: T, i: number) => void): void; export function each(obj: any, cb: any, thisArg?: any): any; export function each(obj: any, cb: any, thisArg?: any) {