trm-core 6.5.0 → 6.5.1

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/README.md CHANGED
@@ -22,3 +22,5 @@ Make sure to open an issue first.
22
22
  Contributions will be merged upon approval.
23
23
 
24
24
  [Click here](https://docs.trmregistry.com/#/CONTRIBUTING) for the full list of TRM contribution guidelines.
25
+
26
+ [<img src="https://trmregistry.com/public/contributors?image=true">](https://docs.trmregistry.com/#/?id=contributors)
package/changelog.txt CHANGED
@@ -8,6 +8,10 @@ Legend
8
8
  + : added
9
9
  - : removed
10
10
 
11
+ 2025-05-08 v6.5.1
12
+ -------------------
13
+ ! rest error handling
14
+
11
15
  2025-05-05 v6.5.0
12
16
  -------------------
13
17
  ! trm-commons ^1.0.0
@@ -107,7 +107,7 @@ class RESTClient {
107
107
  }
108
108
  catch (k) {
109
109
  messageError = k;
110
- message = `Couldn't read error message ${axiosError.response.data.message.abapMsgClass} ${axiosError.response.data.message.abapMsgNumber} ${axiosError.response.data.message.abapMsgV1} ${axiosError.response.data.message.abapMsgV2} ${axiosError.response.data.message.abapMsgV3} ${axiosError.response.data.message.abapMsgV4}`;
110
+ message = `Couldn't read error message ${axiosError.response.data.message.msgid} ${axiosError.response.data.message.msgno} ${axiosError.response.data.message.msgv1} ${axiosError.response.data.message.msgv2} ${axiosError.response.data.message.msgv3} ${axiosError.response.data.message.msgv4}`;
111
111
  }
112
112
  var rfcClientError = new _1.RESTClientError(error.message, sapMessage, axiosError, message);
113
113
  if (messageError) {
@@ -137,10 +137,19 @@ class RESTClient {
137
137
  const aT100 = yield this.readTable('T100', [{ fieldName: 'SPRSL' }, { fieldName: 'ARBGB' }, { fieldName: 'MSGNR' }, { fieldName: 'TEXT' }], `SPRSL EQ '${this._cLangu}' AND ARBGB EQ '${data.class}' AND MSGNR EQ '${msgnr}'`);
138
138
  if (aT100.length === 1 && aT100[0].text) {
139
139
  var msg = aT100[0].text;
140
- msg = msg.replace("&1", data.v1 || '');
141
- msg = msg.replace("&2", data.v2 || '');
142
- msg = msg.replace("&3", data.v3 || '');
143
- msg = msg.replace("&4", data.v4 || '');
140
+ var counter = 1;
141
+ do {
142
+ if (msg.includes(`&${counter}`)) {
143
+ msg = msg.replace(new RegExp(`&${counter}`, 'gmi'), data[`v${counter}`] || '');
144
+ msg = msg.replace(new RegExp(`&${counter}&`, 'gmi'), data[`v${counter}`] || '');
145
+ }
146
+ else {
147
+ msg = msg.replace("&", data[`v${counter}`] || '');
148
+ }
149
+ counter++;
150
+ } while (counter <= 4);
151
+ msg = msg.replace(new RegExp(`&\\d*`, 'gmi'), '');
152
+ msg = msg.replace(new RegExp(`&`, 'gmi'), '');
144
153
  return msg.trim();
145
154
  }
146
155
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trm-core",
3
- "version": "6.5.0",
3
+ "version": "6.5.1",
4
4
  "description": "TRM (Transport Request Manager) Core",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",