graphlit-client 1.0.20240418023 → 1.0.20240418025
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/client.js +19 -10
- package/package.json +1 -1
package/dist/client.js
CHANGED
@@ -91,11 +91,9 @@ class Graphlit {
|
|
91
91
|
cache: new core_1.InMemoryCache(),
|
92
92
|
defaultOptions: {
|
93
93
|
watchQuery: {
|
94
|
-
|
95
|
-
errorPolicy: 'ignore',
|
94
|
+
errorPolicy: 'all',
|
96
95
|
},
|
97
96
|
query: {
|
98
|
-
fetchPolicy: 'network-only',
|
99
97
|
errorPolicy: 'all',
|
100
98
|
},
|
101
99
|
mutate: {
|
@@ -416,9 +414,11 @@ class Graphlit {
|
|
416
414
|
});
|
417
415
|
if (result.errors) {
|
418
416
|
const errorMessage = result.errors.map(err => err.message).join("\n");
|
417
|
+
console.log(errorMessage);
|
419
418
|
throw new Error(errorMessage);
|
420
419
|
}
|
421
420
|
if (!result.data) {
|
421
|
+
console.log('No data returned from mutation.');
|
422
422
|
throw new Error('No data returned from mutation.');
|
423
423
|
}
|
424
424
|
return result.data;
|
@@ -426,9 +426,15 @@ class Graphlit {
|
|
426
426
|
catch (error) {
|
427
427
|
if (error instanceof core_1.ApolloError && error.graphQLErrors.length > 0) {
|
428
428
|
const errorMessage = error.graphQLErrors.map(err => err.message).join("\n");
|
429
|
+
console.log(errorMessage);
|
429
430
|
throw new Error(errorMessage);
|
430
431
|
}
|
432
|
+
if (error instanceof Error) {
|
433
|
+
console.error(error.message);
|
434
|
+
throw error;
|
435
|
+
}
|
431
436
|
else {
|
437
|
+
console.error('An unexpected error occurred');
|
432
438
|
throw error;
|
433
439
|
}
|
434
440
|
}
|
@@ -436,7 +442,6 @@ class Graphlit {
|
|
436
442
|
}
|
437
443
|
queryAndCheckError(query, variables) {
|
438
444
|
return __awaiter(this, void 0, void 0, function* () {
|
439
|
-
var _a, _b;
|
440
445
|
if (this.client === undefined)
|
441
446
|
throw new Error("Apollo Client not configured.");
|
442
447
|
try {
|
@@ -444,15 +449,13 @@ class Graphlit {
|
|
444
449
|
query,
|
445
450
|
variables: variables || {}
|
446
451
|
});
|
447
|
-
if (
|
448
|
-
const errorMessage = result.
|
449
|
-
|
450
|
-
}
|
451
|
-
if ((_b = result.error) === null || _b === void 0 ? void 0 : _b.clientErrors) {
|
452
|
-
const errorMessage = result.error.clientErrors.map(err => err.message).join("\n");
|
452
|
+
if (result.errors) {
|
453
|
+
const errorMessage = result.errors.map(err => err.message).join("\n");
|
454
|
+
console.log(errorMessage);
|
453
455
|
throw new Error(errorMessage);
|
454
456
|
}
|
455
457
|
if (!result.data) {
|
458
|
+
console.log('No data returned from mutation.');
|
456
459
|
throw new Error('No data returned from query');
|
457
460
|
}
|
458
461
|
return result.data;
|
@@ -460,9 +463,15 @@ class Graphlit {
|
|
460
463
|
catch (error) {
|
461
464
|
if (error instanceof core_1.ApolloError && error.graphQLErrors.length > 0) {
|
462
465
|
const errorMessage = error.graphQLErrors.map(err => err.message).join("\n");
|
466
|
+
console.log(errorMessage);
|
463
467
|
throw new Error(errorMessage);
|
464
468
|
}
|
469
|
+
if (error instanceof Error) {
|
470
|
+
console.error(error.message);
|
471
|
+
throw error;
|
472
|
+
}
|
465
473
|
else {
|
474
|
+
console.error('An unexpected error occurred');
|
466
475
|
throw error;
|
467
476
|
}
|
468
477
|
}
|