Skip to content

Commit

Permalink
Fixed bug: this.error is not a function
Browse files Browse the repository at this point in the history
  • Loading branch information
mansoor-omrani committed Jan 5, 2021
1 parent f99a7f7 commit 954d216
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
8 changes: 6 additions & 2 deletions index.cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,11 @@ var ChainLogger = /*#__PURE__*/function (_LoggerBase) {

_this = _super4.call(this);
(0, _locustjsException.throwIfInstantiateAbstract)(ChainLogger, _assertThisInitialized(_this));
(0, _locustjsException.throwIfNull)(next, 'next');

if ((0, _locustjsBase.isNull)(next)) {
next = new NullLogger();
}

(0, _locustjsException.throwIfNotInstanceOf)('next', LoggerBase, next, true);
_this.next = next;
return _this;
Expand Down Expand Up @@ -605,7 +609,7 @@ var DynamicLogger = /*#__PURE__*/function (_LoggerBase3) {
}
}
} catch (e) {
this.error(new Log('danger', 'DynamicLogger._createLogger', type, this.options.host, e));
this.danger(new Log('danger', 'DynamicLogger._createLogger', type, this.options.host, e));
}

return result;
Expand Down
10 changes: 7 additions & 3 deletions index.esm.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isEmpty, isObject, isString, isSomeString, isFunction, isjQueryElement } from 'locustjs-base';
import { isEmpty, isObject, isString, isSomeString, isFunction, isjQueryElement, isNull } from 'locustjs-base';
import {
Exception,
throwIfNull,
Expand Down Expand Up @@ -127,7 +127,11 @@ class ChainLogger extends LoggerBase {
super();

throwIfInstantiateAbstract(ChainLogger, this);
throwIfNull(next, 'next');

if (isNull(next)) {
next = new NullLogger();
}

throwIfNotInstanceOf('next', LoggerBase, next, true);

this.next = next;
Expand Down Expand Up @@ -351,7 +355,7 @@ class DynamicLogger extends LoggerBase {
}
}
} catch (e) {
this.error(new Log('danger', 'DynamicLogger._createLogger', type, this.options.host, e));
this.danger(new Log('danger', 'DynamicLogger._createLogger', type, this.options.host, e));
}

return result;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "locustjs-logging",
"version": "1.0.6",
"version": "1.0.7",
"description": "This library provides various types of loggers that could be employed in any type of front-end application.",
"main": "index.cjs.js",
"module": "index.esm.js",
Expand Down

0 comments on commit 954d216

Please sign in to comment.