@naturalcycles/js-lib 14.177.0 → 14.177.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/error/error.util.js
CHANGED
|
@@ -246,7 +246,9 @@ class AppError extends Error {
|
|
|
246
246
|
}
|
|
247
247
|
constructor(message, data = {}, opt = {}) {
|
|
248
248
|
super(message);
|
|
249
|
-
|
|
249
|
+
// Here we default to `this.constructor.name` on Node, but to 'AppError' on the Frontend
|
|
250
|
+
// because Frontend tends to minify class names, so `constructor.name` is not reliable
|
|
251
|
+
const { name = (0, __1.isServerSide)() ? this.constructor.name : 'AppError', cause } = opt;
|
|
250
252
|
Object.defineProperties(this, {
|
|
251
253
|
name: {
|
|
252
254
|
value: name,
|
package/dist/http/fetcher.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export declare class Fetcher {
|
|
|
15
15
|
*
|
|
16
16
|
* Version is to be incremented every time a difference in behaviour (or a bugfix) is done.
|
|
17
17
|
*/
|
|
18
|
-
static readonly VERSION =
|
|
18
|
+
static readonly VERSION = 2;
|
|
19
19
|
static readonly userAgent: string | undefined;
|
|
20
20
|
private constructor();
|
|
21
21
|
/**
|
package/dist/http/fetcher.js
CHANGED
|
@@ -40,7 +40,7 @@ class Fetcher {
|
|
|
40
40
|
*
|
|
41
41
|
* Version is to be incremented every time a difference in behaviour (or a bugfix) is done.
|
|
42
42
|
*/
|
|
43
|
-
static { this.VERSION =
|
|
43
|
+
static { this.VERSION = 2; }
|
|
44
44
|
static { this.userAgent = (0, env_1.isServerSide)() ? `fetcher${this.VERSION}` : undefined; }
|
|
45
45
|
constructor(cfg = {}) {
|
|
46
46
|
if (typeof globalThis.fetch !== 'function') {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _jsonParseIfPossible, _stringifyAny, _truncate, _truncateMiddle } from '..';
|
|
1
|
+
import { _jsonParseIfPossible, _stringifyAny, _truncate, _truncateMiddle, isServerSide } from '..';
|
|
2
2
|
/**
|
|
3
3
|
* Useful to ensure that error in `catch (err) { ... }`
|
|
4
4
|
* is indeed an Error (and not e.g `string` or `undefined`).
|
|
@@ -228,7 +228,9 @@ export class AppError extends Error {
|
|
|
228
228
|
}
|
|
229
229
|
constructor(message, data = {}, opt = {}) {
|
|
230
230
|
super(message);
|
|
231
|
-
|
|
231
|
+
// Here we default to `this.constructor.name` on Node, but to 'AppError' on the Frontend
|
|
232
|
+
// because Frontend tends to minify class names, so `constructor.name` is not reliable
|
|
233
|
+
const { name = isServerSide() ? this.constructor.name : 'AppError', cause } = opt;
|
|
232
234
|
Object.defineProperties(this, {
|
|
233
235
|
name: {
|
|
234
236
|
value: name,
|
package/dist-esm/http/fetcher.js
CHANGED
|
@@ -584,7 +584,7 @@ _a = Fetcher;
|
|
|
584
584
|
*
|
|
585
585
|
* Version is to be incremented every time a difference in behaviour (or a bugfix) is done.
|
|
586
586
|
*/
|
|
587
|
-
Fetcher.VERSION =
|
|
587
|
+
Fetcher.VERSION = 2;
|
|
588
588
|
Fetcher.userAgent = isServerSide() ? `fetcher${_a.VERSION}` : undefined;
|
|
589
589
|
export function getFetcher(cfg = {}) {
|
|
590
590
|
return Fetcher.create(cfg);
|
package/package.json
CHANGED
package/src/error/error.util.ts
CHANGED
|
@@ -6,7 +6,7 @@ import type {
|
|
|
6
6
|
HttpRequestErrorData,
|
|
7
7
|
ErrorLike,
|
|
8
8
|
} from '..'
|
|
9
|
-
import { _jsonParseIfPossible, _stringifyAny, _truncate, _truncateMiddle } from '..'
|
|
9
|
+
import { _jsonParseIfPossible, _stringifyAny, _truncate, _truncateMiddle, isServerSide } from '..'
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Useful to ensure that error in `catch (err) { ... }`
|
|
@@ -325,7 +325,9 @@ export class AppError<DATA_TYPE extends ErrorData = ErrorData> extends Error {
|
|
|
325
325
|
|
|
326
326
|
constructor(message: string, data = {} as DATA_TYPE, opt: AppErrorOptions = {}) {
|
|
327
327
|
super(message)
|
|
328
|
-
|
|
328
|
+
// Here we default to `this.constructor.name` on Node, but to 'AppError' on the Frontend
|
|
329
|
+
// because Frontend tends to minify class names, so `constructor.name` is not reliable
|
|
330
|
+
const { name = isServerSide() ? this.constructor.name : 'AppError', cause } = opt
|
|
329
331
|
|
|
330
332
|
Object.defineProperties(this, {
|
|
331
333
|
name: {
|
package/src/http/fetcher.ts
CHANGED
|
@@ -71,7 +71,7 @@ export class Fetcher {
|
|
|
71
71
|
*
|
|
72
72
|
* Version is to be incremented every time a difference in behaviour (or a bugfix) is done.
|
|
73
73
|
*/
|
|
74
|
-
static readonly VERSION =
|
|
74
|
+
static readonly VERSION = 2
|
|
75
75
|
static readonly userAgent = isServerSide() ? `fetcher${this.VERSION}` : undefined
|
|
76
76
|
|
|
77
77
|
private constructor(cfg: FetcherCfg & FetcherOptions = {}) {
|