@onlineapps/service-wrapper 3.0.10 → 3.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/ErrorMapper.js +12 -12
- package/src/ServiceWrapper.js +5 -4
package/package.json
CHANGED
package/src/ErrorMapper.js
CHANGED
|
@@ -93,31 +93,31 @@ class ErrorMapper {
|
|
|
93
93
|
if (err instanceof ValidationError) {
|
|
94
94
|
if (err.phase === 'output') {
|
|
95
95
|
this._logger.error(
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
'output schema validation failed - server bug',
|
|
97
|
+
{ err, operation, correlation_id, code: 'INTERNAL_ERROR', status: 500 }
|
|
98
98
|
);
|
|
99
99
|
return this._buildError(500, 'INTERNAL_ERROR', 'Internal validation error', undefined, correlation_id);
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
this._logger.info(
|
|
103
|
-
|
|
104
|
-
'
|
|
103
|
+
'input schema validation failed',
|
|
104
|
+
{ err, operation, correlation_id, code: 'VALIDATION_FAILED', status: 400 }
|
|
105
105
|
);
|
|
106
106
|
return this._buildError(400, 'VALIDATION_FAILED', err.message, err.details, correlation_id);
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
if (err instanceof UnknownOperationError) {
|
|
110
110
|
this._logger.warn(
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
'unknown operation requested',
|
|
112
|
+
{ err, operation, correlation_id, code: 'UNKNOWN_OPERATION', status: 404 }
|
|
113
113
|
);
|
|
114
114
|
return this._buildError(404, 'UNKNOWN_OPERATION', err.message, undefined, correlation_id);
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
if (err instanceof BusinessError) {
|
|
118
118
|
this._logger.info(
|
|
119
|
-
|
|
120
|
-
|
|
119
|
+
'handler raised BusinessError',
|
|
120
|
+
{ err, operation, correlation_id, code: err.code, status: err.status }
|
|
121
121
|
);
|
|
122
122
|
return this._buildError(err.status, err.code, err.message, err.details, correlation_id);
|
|
123
123
|
}
|
|
@@ -125,15 +125,15 @@ class ErrorMapper {
|
|
|
125
125
|
if (err instanceof AbortError || (err && err.name === 'AbortError')) {
|
|
126
126
|
const message = err && err.message ? err.message : 'Invocation aborted';
|
|
127
127
|
this._logger.info(
|
|
128
|
-
|
|
129
|
-
'
|
|
128
|
+
'invocation aborted by client',
|
|
129
|
+
{ err, operation, correlation_id, code: 'CLIENT_CANCELLED', status: 499 }
|
|
130
130
|
);
|
|
131
131
|
return this._buildError(499, 'CLIENT_CANCELLED', message, undefined, correlation_id);
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
this._logger.error(
|
|
135
|
-
|
|
136
|
-
'
|
|
135
|
+
'unhandled error during operation invocation',
|
|
136
|
+
{ err, operation, correlation_id, code: 'INTERNAL_ERROR', status: 500, stack: err && err.stack }
|
|
137
137
|
);
|
|
138
138
|
return this._buildError(500, 'INTERNAL_ERROR', 'An internal error occurred', undefined, correlation_id);
|
|
139
139
|
}
|
package/src/ServiceWrapper.js
CHANGED
|
@@ -2067,12 +2067,13 @@ class ServiceWrapper {
|
|
|
2067
2067
|
|
|
2068
2068
|
this._contextBuilder = new ContextBuilder({
|
|
2069
2069
|
connectors: {
|
|
2070
|
-
storage:
|
|
2070
|
+
storage: null,
|
|
2071
2071
|
cache: this.cacheConnector || null,
|
|
2072
2072
|
http: null,
|
|
2073
2073
|
secrets: null,
|
|
2074
2074
|
monitoring: this.monitoring || null,
|
|
2075
|
-
mq: this.mqClient || null
|
|
2075
|
+
mq: this.mqClient || null,
|
|
2076
|
+
state: this.stateConnector || null
|
|
2076
2077
|
},
|
|
2077
2078
|
config: this.config,
|
|
2078
2079
|
logger
|
|
@@ -2115,7 +2116,7 @@ class ServiceWrapper {
|
|
|
2115
2116
|
`[ServiceWrapper] Registered handlers without declaration: ${orphaned.join(', ')}`
|
|
2116
2117
|
);
|
|
2117
2118
|
}
|
|
2118
|
-
this.logger?.info({ count: declaredOps.size }
|
|
2119
|
+
this.logger?.info('operations-handler alignment verified', { count: declaredOps.size });
|
|
2119
2120
|
}
|
|
2120
2121
|
|
|
2121
2122
|
/**
|
|
@@ -2167,7 +2168,7 @@ class ServiceWrapper {
|
|
|
2167
2168
|
try {
|
|
2168
2169
|
await release();
|
|
2169
2170
|
} catch (e) {
|
|
2170
|
-
this.logger?.error({ err: e, operation }
|
|
2171
|
+
this.logger?.error('context release failed', { err: e, operation });
|
|
2171
2172
|
}
|
|
2172
2173
|
}
|
|
2173
2174
|
}
|