iptuapi 2.0.1 → 2.0.2

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/dist/index.js CHANGED
@@ -216,7 +216,14 @@ var IPTUClient = class {
216
216
  } catch {
217
217
  body = { detail: response.statusText };
218
218
  }
219
- const message = body.detail || `HTTP ${response.status}`;
219
+ let message;
220
+ const detail = body.detail;
221
+ if (detail && typeof detail === "object") {
222
+ const detailObj = detail;
223
+ message = detailObj.error || detailObj.detail || detailObj.message || JSON.stringify(detail);
224
+ } else {
225
+ message = detail || `HTTP ${response.status}`;
226
+ }
220
227
  switch (response.status) {
221
228
  case 400:
222
229
  case 422:
package/dist/index.mjs CHANGED
@@ -181,7 +181,14 @@ var IPTUClient = class {
181
181
  } catch {
182
182
  body = { detail: response.statusText };
183
183
  }
184
- const message = body.detail || `HTTP ${response.status}`;
184
+ let message;
185
+ const detail = body.detail;
186
+ if (detail && typeof detail === "object") {
187
+ const detailObj = detail;
188
+ message = detailObj.error || detailObj.detail || detailObj.message || JSON.stringify(detail);
189
+ } else {
190
+ message = detail || `HTTP ${response.status}`;
191
+ }
185
192
  switch (response.status) {
186
193
  case 400:
187
194
  case 422:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iptuapi",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "description": "SDK oficial para a IPTU API - Dados de IPTU de São Paulo, Belo Horizonte e Recife",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",