Skip to content

Commit ec0a25e

Browse files
committed
Domains error logging enhancement
1 parent f3f275e commit ec0a25e

File tree

4 files changed

+12
-3
lines changed

4 files changed

+12
-3
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# CHANGELOG
22

3+
## 2.0.3 (October 27, 2020)
4+
5+
### Improvements
6+
7+
- Domains error logging enhancement.
8+
39
## 2.0.2 (October 27, 2020)
410

511
### Bug Fixes

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "node-execution-context",
3-
"version": "2.0.2",
3+
"version": "2.0.3",
44
"description": "Provides execution context wrapper for node JS, can be used to create execution wrapper for handling requests and more",
55
"author": "Oded Goldglas <odedglas@gmail.com>",
66
"license": "ISC",

src/ExecutionContext/constants.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* @type {Object<String>}
44
*/
55
exports.ExecutionContextErrors = {
6-
CONTEXT_ALREADY_DECLARED: 'Execution context is already declared for the default domain, use the domain option to create a separate context.',
6+
CONTEXT_ALREADY_DECLARED: 'Execution context is already declared for the given domain, use the domain option to create a separate context.',
77
CONTEXT_DOES_NOT_EXISTS: 'Execution context does not exists, please ensure to call create/run before.',
88
MONITOR_MISS_CONFIGURATION: 'Monitoring option is off by default, please call `configure` with the proper options.'
99
};

src/ExecutionContext/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,10 @@ class ExecutionContext {
9090
if (rootContext) {
9191

9292
// Execution context creation is allowed once per domain
93-
if (domain === rootContext.domain) return handleError(ExecutionContextErrors.CONTEXT_ALREADY_DECLARED);
93+
if (domain === rootContext.domain) return handleError([
94+
ExecutionContextErrors.CONTEXT_ALREADY_DECLARED,
95+
`Given Domain: ${domain} / Current Domain: ${rootContext.domain}`
96+
].join(' '));
9497

9598
// Setting up domain initial context
9699
initialContext = { ...rootContext.context, ...initialContext };

0 commit comments

Comments
 (0)