Skip to content

Commit

Permalink
- AbstractApp fix, logger fatal color changed
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton Nefjodov committed Dec 21, 2022
1 parent cbac3a3 commit 985ff4c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "domwires",
"version": "0.9.120",
"version": "0.9.125",
"description": "Flexible and extensible MVC framework",
"repository": {
"type": "git",
Expand Down
12 changes: 9 additions & 3 deletions src/com/domwires/core/app/AbstractApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,17 @@ export abstract class AbstractApp<TAppConfig = unknown> extends MessageDispatche
}
else
{
fetch(configPath).then(() =>
fetch(configPath).then((value) =>
{
if (configLoaded) configLoaded(true);
}).catch(() =>
value.text().then(jsonStr =>
{
this._appConfigJson = JSON.parse(jsonStr);

if (configLoaded) configLoaded(true);
});
}).catch(e =>
{
this.fatal(e);
if (configLoaded) configLoaded(false);
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/com/domwires/logger/ILogger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export class Logger extends AbstractDisposable implements ILogger
if (this.loglevel.level >= LogLevel.ERROR.level)
{
console.error(Logger.paintPrefix(this.caller(args), this.t) + " " +
Logger.paintArgs(Color.TP_ANSI_BG_CYAN, ...args));
Logger.paintArgs(Color.TP_ANSI_FG_RED, ...args));
}

return this;
Expand Down
17 changes: 13 additions & 4 deletions test/AppTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,25 @@ describe('AppTest', function (this: Suite)
{
}

it('testAppConfig', async () =>
it('testAppConfig', (done) =>
{
const f = new Factory(new Logger(LogLevel.VERBOSE));
const app = f.getInstance<MockApp>(MockApp);

app.loadConfig(success =>
{
expect(success).true;
expect(app.appConfigJson.name).equals("Anton");
expect(app.appConfigJson.age).equals(36);
try
{
expect(success).true;
expect(app.appConfigJson.name).equals("Anton");
expect(app.appConfigJson.age).equals(36);

done();
} catch (e)
{
console.error(e);
throw e;
}
});
});
});

0 comments on commit 985ff4c

Please sign in to comment.