@langchain/langgraph 0.2.15 → 0.2.16
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/channels/last_value.cjs +3 -1
- package/dist/channels/last_value.js +3 -1
- package/dist/errors.cjs +43 -25
- package/dist/errors.d.ts +22 -15
- package/dist/errors.js +41 -24
- package/dist/graph/state.cjs +5 -3
- package/dist/graph/state.js +5 -3
- package/dist/pregel/algo.cjs +4 -2
- package/dist/pregel/algo.js +4 -2
- package/dist/pregel/index.cjs +3 -1
- package/dist/pregel/index.js +3 -1
- package/dist/pregel/loop.cjs +3 -1
- package/dist/pregel/loop.js +3 -1
- package/package.json +1 -1
|
@@ -39,7 +39,9 @@ class LastValue extends base_js_1.BaseChannel {
|
|
|
39
39
|
return false;
|
|
40
40
|
}
|
|
41
41
|
if (values.length !== 1) {
|
|
42
|
-
throw new errors_js_1.InvalidUpdateError("LastValue can only receive one value per step."
|
|
42
|
+
throw new errors_js_1.InvalidUpdateError("LastValue can only receive one value per step.", {
|
|
43
|
+
lc_error_code: "INVALID_CONCURRENT_GRAPH_UPDATE",
|
|
44
|
+
});
|
|
43
45
|
}
|
|
44
46
|
// eslint-disable-next-line prefer-destructuring
|
|
45
47
|
this.value = values[values.length - 1];
|
|
@@ -36,7 +36,9 @@ export class LastValue extends BaseChannel {
|
|
|
36
36
|
return false;
|
|
37
37
|
}
|
|
38
38
|
if (values.length !== 1) {
|
|
39
|
-
throw new InvalidUpdateError("LastValue can only receive one value per step."
|
|
39
|
+
throw new InvalidUpdateError("LastValue can only receive one value per step.", {
|
|
40
|
+
lc_error_code: "INVALID_CONCURRENT_GRAPH_UPDATE",
|
|
41
|
+
});
|
|
40
42
|
}
|
|
41
43
|
// eslint-disable-next-line prefer-destructuring
|
|
42
44
|
this.value = values[values.length - 1];
|
package/dist/errors.cjs
CHANGED
|
@@ -1,9 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getSubgraphsSeenSet = exports.MultipleSubgraphsError = exports.InvalidUpdateError = exports.EmptyChannelError = exports.EmptyInputError = exports.isGraphInterrupt = exports.NodeInterrupt = exports.GraphInterrupt = exports.GraphValueError = exports.GraphRecursionError = void 0;
|
|
4
|
-
class
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
exports.getSubgraphsSeenSet = exports.MultipleSubgraphsError = exports.InvalidUpdateError = exports.EmptyChannelError = exports.EmptyInputError = exports.isGraphInterrupt = exports.NodeInterrupt = exports.GraphInterrupt = exports.GraphValueError = exports.GraphRecursionError = exports.BaseLangGraphError = void 0;
|
|
4
|
+
// TODO: Merge with base LangChain error class when we drop support for core@0.2.0
|
|
5
|
+
class BaseLangGraphError extends Error {
|
|
6
|
+
constructor(message, fields) {
|
|
7
|
+
let finalMessage = message ?? "";
|
|
8
|
+
if (fields?.lc_error_code) {
|
|
9
|
+
finalMessage = `${finalMessage}\n\nTroubleshooting URL: https://js.langchain.com/docs/troubleshooting/errors/${fields.lc_error_code}/\n`;
|
|
10
|
+
}
|
|
11
|
+
super(finalMessage);
|
|
12
|
+
Object.defineProperty(this, "lc_error_code", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
configurable: true,
|
|
15
|
+
writable: true,
|
|
16
|
+
value: void 0
|
|
17
|
+
});
|
|
18
|
+
this.lc_error_code = fields?.lc_error_code;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.BaseLangGraphError = BaseLangGraphError;
|
|
22
|
+
class GraphRecursionError extends BaseLangGraphError {
|
|
23
|
+
constructor(message, fields) {
|
|
24
|
+
super(message, fields);
|
|
7
25
|
this.name = "GraphRecursionError";
|
|
8
26
|
}
|
|
9
27
|
static get unminifiable_name() {
|
|
@@ -11,9 +29,9 @@ class GraphRecursionError extends Error {
|
|
|
11
29
|
}
|
|
12
30
|
}
|
|
13
31
|
exports.GraphRecursionError = GraphRecursionError;
|
|
14
|
-
class GraphValueError extends
|
|
15
|
-
constructor(message) {
|
|
16
|
-
super(message);
|
|
32
|
+
class GraphValueError extends BaseLangGraphError {
|
|
33
|
+
constructor(message, fields) {
|
|
34
|
+
super(message, fields);
|
|
17
35
|
this.name = "GraphValueError";
|
|
18
36
|
}
|
|
19
37
|
static get unminifiable_name() {
|
|
@@ -21,9 +39,9 @@ class GraphValueError extends Error {
|
|
|
21
39
|
}
|
|
22
40
|
}
|
|
23
41
|
exports.GraphValueError = GraphValueError;
|
|
24
|
-
class GraphInterrupt extends
|
|
25
|
-
constructor(interrupts
|
|
26
|
-
super(JSON.stringify(interrupts, null, 2));
|
|
42
|
+
class GraphInterrupt extends BaseLangGraphError {
|
|
43
|
+
constructor(interrupts, fields) {
|
|
44
|
+
super(JSON.stringify(interrupts, null, 2), fields);
|
|
27
45
|
Object.defineProperty(this, "interrupts", {
|
|
28
46
|
enumerable: true,
|
|
29
47
|
configurable: true,
|
|
@@ -31,7 +49,7 @@ class GraphInterrupt extends Error {
|
|
|
31
49
|
value: void 0
|
|
32
50
|
});
|
|
33
51
|
this.name = "GraphInterrupt";
|
|
34
|
-
this.interrupts = interrupts;
|
|
52
|
+
this.interrupts = interrupts ?? [];
|
|
35
53
|
}
|
|
36
54
|
static get unminifiable_name() {
|
|
37
55
|
return "GraphInterrupt";
|
|
@@ -40,13 +58,13 @@ class GraphInterrupt extends Error {
|
|
|
40
58
|
exports.GraphInterrupt = GraphInterrupt;
|
|
41
59
|
/** Raised by a node to interrupt execution. */
|
|
42
60
|
class NodeInterrupt extends GraphInterrupt {
|
|
43
|
-
constructor(message) {
|
|
61
|
+
constructor(message, fields) {
|
|
44
62
|
super([
|
|
45
63
|
{
|
|
46
64
|
value: message,
|
|
47
65
|
when: "during",
|
|
48
66
|
},
|
|
49
|
-
]);
|
|
67
|
+
], fields);
|
|
50
68
|
this.name = "NodeInterrupt";
|
|
51
69
|
}
|
|
52
70
|
static get unminifiable_name() {
|
|
@@ -62,9 +80,9 @@ function isGraphInterrupt(e) {
|
|
|
62
80
|
].includes(e.name));
|
|
63
81
|
}
|
|
64
82
|
exports.isGraphInterrupt = isGraphInterrupt;
|
|
65
|
-
class EmptyInputError extends
|
|
66
|
-
constructor(message) {
|
|
67
|
-
super(message);
|
|
83
|
+
class EmptyInputError extends BaseLangGraphError {
|
|
84
|
+
constructor(message, fields) {
|
|
85
|
+
super(message, fields);
|
|
68
86
|
this.name = "EmptyInputError";
|
|
69
87
|
}
|
|
70
88
|
static get unminifiable_name() {
|
|
@@ -72,9 +90,9 @@ class EmptyInputError extends Error {
|
|
|
72
90
|
}
|
|
73
91
|
}
|
|
74
92
|
exports.EmptyInputError = EmptyInputError;
|
|
75
|
-
class EmptyChannelError extends
|
|
76
|
-
constructor(message) {
|
|
77
|
-
super(message);
|
|
93
|
+
class EmptyChannelError extends BaseLangGraphError {
|
|
94
|
+
constructor(message, fields) {
|
|
95
|
+
super(message, fields);
|
|
78
96
|
this.name = "EmptyChannelError";
|
|
79
97
|
}
|
|
80
98
|
static get unminifiable_name() {
|
|
@@ -82,9 +100,9 @@ class EmptyChannelError extends Error {
|
|
|
82
100
|
}
|
|
83
101
|
}
|
|
84
102
|
exports.EmptyChannelError = EmptyChannelError;
|
|
85
|
-
class InvalidUpdateError extends
|
|
86
|
-
constructor(message) {
|
|
87
|
-
super(message);
|
|
103
|
+
class InvalidUpdateError extends BaseLangGraphError {
|
|
104
|
+
constructor(message, fields) {
|
|
105
|
+
super(message, fields);
|
|
88
106
|
this.name = "InvalidUpdateError";
|
|
89
107
|
}
|
|
90
108
|
static get unminifiable_name() {
|
|
@@ -92,9 +110,9 @@ class InvalidUpdateError extends Error {
|
|
|
92
110
|
}
|
|
93
111
|
}
|
|
94
112
|
exports.InvalidUpdateError = InvalidUpdateError;
|
|
95
|
-
class MultipleSubgraphsError extends
|
|
96
|
-
constructor(message) {
|
|
97
|
-
super(message);
|
|
113
|
+
class MultipleSubgraphsError extends BaseLangGraphError {
|
|
114
|
+
constructor(message, fields) {
|
|
115
|
+
super(message, fields);
|
|
98
116
|
this.name = "MultipleSubgraphError";
|
|
99
117
|
}
|
|
100
118
|
static get unminifiable_name() {
|
package/dist/errors.d.ts
CHANGED
|
@@ -1,37 +1,44 @@
|
|
|
1
1
|
import { Interrupt } from "./constants.js";
|
|
2
|
-
export
|
|
3
|
-
|
|
2
|
+
export type BaseLangGraphErrorFields = {
|
|
3
|
+
lc_error_code?: string;
|
|
4
|
+
};
|
|
5
|
+
export declare class BaseLangGraphError extends Error {
|
|
6
|
+
lc_error_code?: string;
|
|
7
|
+
constructor(message?: string, fields?: BaseLangGraphErrorFields);
|
|
8
|
+
}
|
|
9
|
+
export declare class GraphRecursionError extends BaseLangGraphError {
|
|
10
|
+
constructor(message?: string, fields?: BaseLangGraphErrorFields);
|
|
4
11
|
static get unminifiable_name(): string;
|
|
5
12
|
}
|
|
6
|
-
export declare class GraphValueError extends
|
|
7
|
-
constructor(message?: string);
|
|
13
|
+
export declare class GraphValueError extends BaseLangGraphError {
|
|
14
|
+
constructor(message?: string, fields?: BaseLangGraphErrorFields);
|
|
8
15
|
static get unminifiable_name(): string;
|
|
9
16
|
}
|
|
10
|
-
export declare class GraphInterrupt extends
|
|
17
|
+
export declare class GraphInterrupt extends BaseLangGraphError {
|
|
11
18
|
interrupts: Interrupt[];
|
|
12
|
-
constructor(interrupts?: Interrupt[]);
|
|
19
|
+
constructor(interrupts?: Interrupt[], fields?: BaseLangGraphErrorFields);
|
|
13
20
|
static get unminifiable_name(): string;
|
|
14
21
|
}
|
|
15
22
|
/** Raised by a node to interrupt execution. */
|
|
16
23
|
export declare class NodeInterrupt extends GraphInterrupt {
|
|
17
|
-
constructor(message: string);
|
|
24
|
+
constructor(message: string, fields?: BaseLangGraphErrorFields);
|
|
18
25
|
static get unminifiable_name(): string;
|
|
19
26
|
}
|
|
20
27
|
export declare function isGraphInterrupt(e?: GraphInterrupt | Error): e is GraphInterrupt;
|
|
21
|
-
export declare class EmptyInputError extends
|
|
22
|
-
constructor(message?: string);
|
|
28
|
+
export declare class EmptyInputError extends BaseLangGraphError {
|
|
29
|
+
constructor(message?: string, fields?: BaseLangGraphErrorFields);
|
|
23
30
|
static get unminifiable_name(): string;
|
|
24
31
|
}
|
|
25
|
-
export declare class EmptyChannelError extends
|
|
26
|
-
constructor(message?: string);
|
|
32
|
+
export declare class EmptyChannelError extends BaseLangGraphError {
|
|
33
|
+
constructor(message?: string, fields?: BaseLangGraphErrorFields);
|
|
27
34
|
static get unminifiable_name(): string;
|
|
28
35
|
}
|
|
29
|
-
export declare class InvalidUpdateError extends
|
|
30
|
-
constructor(message?: string);
|
|
36
|
+
export declare class InvalidUpdateError extends BaseLangGraphError {
|
|
37
|
+
constructor(message?: string, fields?: BaseLangGraphErrorFields);
|
|
31
38
|
static get unminifiable_name(): string;
|
|
32
39
|
}
|
|
33
|
-
export declare class MultipleSubgraphsError extends
|
|
34
|
-
constructor(message?: string);
|
|
40
|
+
export declare class MultipleSubgraphsError extends BaseLangGraphError {
|
|
41
|
+
constructor(message?: string, fields?: BaseLangGraphErrorFields);
|
|
35
42
|
static get unminifiable_name(): string;
|
|
36
43
|
}
|
|
37
44
|
/**
|
package/dist/errors.js
CHANGED
|
@@ -1,24 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
// TODO: Merge with base LangChain error class when we drop support for core@0.2.0
|
|
2
|
+
export class BaseLangGraphError extends Error {
|
|
3
|
+
constructor(message, fields) {
|
|
4
|
+
let finalMessage = message ?? "";
|
|
5
|
+
if (fields?.lc_error_code) {
|
|
6
|
+
finalMessage = `${finalMessage}\n\nTroubleshooting URL: https://js.langchain.com/docs/troubleshooting/errors/${fields.lc_error_code}/\n`;
|
|
7
|
+
}
|
|
8
|
+
super(finalMessage);
|
|
9
|
+
Object.defineProperty(this, "lc_error_code", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
configurable: true,
|
|
12
|
+
writable: true,
|
|
13
|
+
value: void 0
|
|
14
|
+
});
|
|
15
|
+
this.lc_error_code = fields?.lc_error_code;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export class GraphRecursionError extends BaseLangGraphError {
|
|
19
|
+
constructor(message, fields) {
|
|
20
|
+
super(message, fields);
|
|
4
21
|
this.name = "GraphRecursionError";
|
|
5
22
|
}
|
|
6
23
|
static get unminifiable_name() {
|
|
7
24
|
return "GraphRecursionError";
|
|
8
25
|
}
|
|
9
26
|
}
|
|
10
|
-
export class GraphValueError extends
|
|
11
|
-
constructor(message) {
|
|
12
|
-
super(message);
|
|
27
|
+
export class GraphValueError extends BaseLangGraphError {
|
|
28
|
+
constructor(message, fields) {
|
|
29
|
+
super(message, fields);
|
|
13
30
|
this.name = "GraphValueError";
|
|
14
31
|
}
|
|
15
32
|
static get unminifiable_name() {
|
|
16
33
|
return "GraphValueError";
|
|
17
34
|
}
|
|
18
35
|
}
|
|
19
|
-
export class GraphInterrupt extends
|
|
20
|
-
constructor(interrupts
|
|
21
|
-
super(JSON.stringify(interrupts, null, 2));
|
|
36
|
+
export class GraphInterrupt extends BaseLangGraphError {
|
|
37
|
+
constructor(interrupts, fields) {
|
|
38
|
+
super(JSON.stringify(interrupts, null, 2), fields);
|
|
22
39
|
Object.defineProperty(this, "interrupts", {
|
|
23
40
|
enumerable: true,
|
|
24
41
|
configurable: true,
|
|
@@ -26,7 +43,7 @@ export class GraphInterrupt extends Error {
|
|
|
26
43
|
value: void 0
|
|
27
44
|
});
|
|
28
45
|
this.name = "GraphInterrupt";
|
|
29
|
-
this.interrupts = interrupts;
|
|
46
|
+
this.interrupts = interrupts ?? [];
|
|
30
47
|
}
|
|
31
48
|
static get unminifiable_name() {
|
|
32
49
|
return "GraphInterrupt";
|
|
@@ -34,13 +51,13 @@ export class GraphInterrupt extends Error {
|
|
|
34
51
|
}
|
|
35
52
|
/** Raised by a node to interrupt execution. */
|
|
36
53
|
export class NodeInterrupt extends GraphInterrupt {
|
|
37
|
-
constructor(message) {
|
|
54
|
+
constructor(message, fields) {
|
|
38
55
|
super([
|
|
39
56
|
{
|
|
40
57
|
value: message,
|
|
41
58
|
when: "during",
|
|
42
59
|
},
|
|
43
|
-
]);
|
|
60
|
+
], fields);
|
|
44
61
|
this.name = "NodeInterrupt";
|
|
45
62
|
}
|
|
46
63
|
static get unminifiable_name() {
|
|
@@ -54,36 +71,36 @@ export function isGraphInterrupt(e) {
|
|
|
54
71
|
NodeInterrupt.unminifiable_name,
|
|
55
72
|
].includes(e.name));
|
|
56
73
|
}
|
|
57
|
-
export class EmptyInputError extends
|
|
58
|
-
constructor(message) {
|
|
59
|
-
super(message);
|
|
74
|
+
export class EmptyInputError extends BaseLangGraphError {
|
|
75
|
+
constructor(message, fields) {
|
|
76
|
+
super(message, fields);
|
|
60
77
|
this.name = "EmptyInputError";
|
|
61
78
|
}
|
|
62
79
|
static get unminifiable_name() {
|
|
63
80
|
return "EmptyInputError";
|
|
64
81
|
}
|
|
65
82
|
}
|
|
66
|
-
export class EmptyChannelError extends
|
|
67
|
-
constructor(message) {
|
|
68
|
-
super(message);
|
|
83
|
+
export class EmptyChannelError extends BaseLangGraphError {
|
|
84
|
+
constructor(message, fields) {
|
|
85
|
+
super(message, fields);
|
|
69
86
|
this.name = "EmptyChannelError";
|
|
70
87
|
}
|
|
71
88
|
static get unminifiable_name() {
|
|
72
89
|
return "EmptyChannelError";
|
|
73
90
|
}
|
|
74
91
|
}
|
|
75
|
-
export class InvalidUpdateError extends
|
|
76
|
-
constructor(message) {
|
|
77
|
-
super(message);
|
|
92
|
+
export class InvalidUpdateError extends BaseLangGraphError {
|
|
93
|
+
constructor(message, fields) {
|
|
94
|
+
super(message, fields);
|
|
78
95
|
this.name = "InvalidUpdateError";
|
|
79
96
|
}
|
|
80
97
|
static get unminifiable_name() {
|
|
81
98
|
return "InvalidUpdateError";
|
|
82
99
|
}
|
|
83
100
|
}
|
|
84
|
-
export class MultipleSubgraphsError extends
|
|
85
|
-
constructor(message) {
|
|
86
|
-
super(message);
|
|
101
|
+
export class MultipleSubgraphsError extends BaseLangGraphError {
|
|
102
|
+
constructor(message, fields) {
|
|
103
|
+
super(message, fields);
|
|
87
104
|
this.name = "MultipleSubgraphError";
|
|
88
105
|
}
|
|
89
106
|
static get unminifiable_name() {
|
package/dist/graph/state.cjs
CHANGED
|
@@ -238,14 +238,14 @@ class StateGraph extends graph_js_1.Graph {
|
|
|
238
238
|
throw new Error("END cannot be a start node");
|
|
239
239
|
}
|
|
240
240
|
if (!Object.keys(this.nodes).some((node) => node === start)) {
|
|
241
|
-
throw new Error(`Need to
|
|
241
|
+
throw new Error(`Need to add a node named "${start}" first`);
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
244
|
if (endKey === graph_js_1.END) {
|
|
245
245
|
throw new Error("END cannot be an end node");
|
|
246
246
|
}
|
|
247
247
|
if (!Object.keys(this.nodes).some((node) => node === endKey)) {
|
|
248
|
-
throw new Error(`Need to
|
|
248
|
+
throw new Error(`Need to add a node named "${endKey}" first`);
|
|
249
249
|
}
|
|
250
250
|
this.waitingEdges.add([startKey, endKey]);
|
|
251
251
|
return this;
|
|
@@ -326,7 +326,9 @@ class CompiledStateGraph extends graph_js_1.CompiledGraph {
|
|
|
326
326
|
}
|
|
327
327
|
else if (typeof input !== "object" || Array.isArray(input)) {
|
|
328
328
|
const typeofInput = Array.isArray(input) ? "array" : typeof input;
|
|
329
|
-
throw new errors_js_1.InvalidUpdateError(`Expected object,
|
|
329
|
+
throw new errors_js_1.InvalidUpdateError(`Expected node "${key.toString()}" to return an object, received ${typeofInput}`, {
|
|
330
|
+
lc_error_code: "INVALID_GRAPH_NODE_RETURN_VALUE",
|
|
331
|
+
});
|
|
330
332
|
}
|
|
331
333
|
else {
|
|
332
334
|
return key in input ? input[key] : write_js_1.SKIP_WRITE;
|
package/dist/graph/state.js
CHANGED
|
@@ -235,14 +235,14 @@ export class StateGraph extends Graph {
|
|
|
235
235
|
throw new Error("END cannot be a start node");
|
|
236
236
|
}
|
|
237
237
|
if (!Object.keys(this.nodes).some((node) => node === start)) {
|
|
238
|
-
throw new Error(`Need to
|
|
238
|
+
throw new Error(`Need to add a node named "${start}" first`);
|
|
239
239
|
}
|
|
240
240
|
}
|
|
241
241
|
if (endKey === END) {
|
|
242
242
|
throw new Error("END cannot be an end node");
|
|
243
243
|
}
|
|
244
244
|
if (!Object.keys(this.nodes).some((node) => node === endKey)) {
|
|
245
|
-
throw new Error(`Need to
|
|
245
|
+
throw new Error(`Need to add a node named "${endKey}" first`);
|
|
246
246
|
}
|
|
247
247
|
this.waitingEdges.add([startKey, endKey]);
|
|
248
248
|
return this;
|
|
@@ -322,7 +322,9 @@ export class CompiledStateGraph extends CompiledGraph {
|
|
|
322
322
|
}
|
|
323
323
|
else if (typeof input !== "object" || Array.isArray(input)) {
|
|
324
324
|
const typeofInput = Array.isArray(input) ? "array" : typeof input;
|
|
325
|
-
throw new InvalidUpdateError(`Expected object,
|
|
325
|
+
throw new InvalidUpdateError(`Expected node "${key.toString()}" to return an object, received ${typeofInput}`, {
|
|
326
|
+
lc_error_code: "INVALID_GRAPH_NODE_RETURN_VALUE",
|
|
327
|
+
});
|
|
326
328
|
}
|
|
327
329
|
else {
|
|
328
330
|
return key in input ? input[key] : SKIP_WRITE;
|
package/dist/pregel/algo.cjs
CHANGED
|
@@ -84,7 +84,7 @@ writes) {
|
|
|
84
84
|
throw new errors_js_1.InvalidUpdateError(`Invalid packet type, expected SendProtocol, got ${JSON.stringify(value)}`);
|
|
85
85
|
}
|
|
86
86
|
if (!(value.node in processes)) {
|
|
87
|
-
throw new errors_js_1.InvalidUpdateError(`Invalid node name ${value.node} in packet`);
|
|
87
|
+
throw new errors_js_1.InvalidUpdateError(`Invalid node name "${value.node}" in Send packet`);
|
|
88
88
|
}
|
|
89
89
|
// replace any runtime values with placeholders
|
|
90
90
|
managed.replaceRuntimeValues(step, value.args);
|
|
@@ -178,7 +178,9 @@ getNextVersion) {
|
|
|
178
178
|
}
|
|
179
179
|
catch (e) {
|
|
180
180
|
if (e.name === errors_js_1.InvalidUpdateError.unminifiable_name) {
|
|
181
|
-
|
|
181
|
+
const wrappedError = new errors_js_1.InvalidUpdateError(`Invalid update for channel "${chan}" with values ${JSON.stringify(vals)}: ${e.message}`);
|
|
182
|
+
wrappedError.lc_error_code = e.lc_error_code;
|
|
183
|
+
throw wrappedError;
|
|
182
184
|
}
|
|
183
185
|
else {
|
|
184
186
|
throw e;
|
package/dist/pregel/algo.js
CHANGED
|
@@ -78,7 +78,7 @@ writes) {
|
|
|
78
78
|
throw new InvalidUpdateError(`Invalid packet type, expected SendProtocol, got ${JSON.stringify(value)}`);
|
|
79
79
|
}
|
|
80
80
|
if (!(value.node in processes)) {
|
|
81
|
-
throw new InvalidUpdateError(`Invalid node name ${value.node} in packet`);
|
|
81
|
+
throw new InvalidUpdateError(`Invalid node name "${value.node}" in Send packet`);
|
|
82
82
|
}
|
|
83
83
|
// replace any runtime values with placeholders
|
|
84
84
|
managed.replaceRuntimeValues(step, value.args);
|
|
@@ -171,7 +171,9 @@ getNextVersion) {
|
|
|
171
171
|
}
|
|
172
172
|
catch (e) {
|
|
173
173
|
if (e.name === InvalidUpdateError.unminifiable_name) {
|
|
174
|
-
|
|
174
|
+
const wrappedError = new InvalidUpdateError(`Invalid update for channel "${chan}" with values ${JSON.stringify(vals)}: ${e.message}`);
|
|
175
|
+
wrappedError.lc_error_code = e.lc_error_code;
|
|
176
|
+
throw wrappedError;
|
|
175
177
|
}
|
|
176
178
|
else {
|
|
177
179
|
throw e;
|
package/dist/pregel/index.cjs
CHANGED
|
@@ -794,7 +794,9 @@ class Pregel extends runnables_1.Runnable {
|
|
|
794
794
|
`Recursion limit of ${config.recursionLimit} reached`,
|
|
795
795
|
"without hitting a stop condition. You can increase the",
|
|
796
796
|
`limit by setting the "recursionLimit" config key.`,
|
|
797
|
-
].join(" ")
|
|
797
|
+
].join(" "), {
|
|
798
|
+
lc_error_code: "GRAPH_RECURSION_LIMIT",
|
|
799
|
+
});
|
|
798
800
|
}
|
|
799
801
|
await Promise.all(loop?.checkpointerPromises ?? []);
|
|
800
802
|
await runManager?.handleChainEnd(loop.output);
|
package/dist/pregel/index.js
CHANGED
|
@@ -787,7 +787,9 @@ export class Pregel extends Runnable {
|
|
|
787
787
|
`Recursion limit of ${config.recursionLimit} reached`,
|
|
788
788
|
"without hitting a stop condition. You can increase the",
|
|
789
789
|
`limit by setting the "recursionLimit" config key.`,
|
|
790
|
-
].join(" ")
|
|
790
|
+
].join(" "), {
|
|
791
|
+
lc_error_code: "GRAPH_RECURSION_LIMIT",
|
|
792
|
+
});
|
|
791
793
|
}
|
|
792
794
|
await Promise.all(loop?.checkpointerPromises ?? []);
|
|
793
795
|
await runManager?.handleChainEnd(loop.output);
|
package/dist/pregel/loop.cjs
CHANGED
|
@@ -313,7 +313,9 @@ class PregelLoop {
|
|
|
313
313
|
"This is not allowed if checkpointing is enabled.",
|
|
314
314
|
"",
|
|
315
315
|
`You can disable checkpointing for a subgraph by compiling it with ".compile({ checkpointer: false });"`,
|
|
316
|
-
].join("\n")
|
|
316
|
+
].join("\n"), {
|
|
317
|
+
lc_error_code: "MULTIPLE_SUBGRAPHS",
|
|
318
|
+
});
|
|
317
319
|
}
|
|
318
320
|
else {
|
|
319
321
|
(0, errors_js_1.getSubgraphsSeenSet)().add(config.configurable?.checkpoint_ns);
|
package/dist/pregel/loop.js
CHANGED
|
@@ -309,7 +309,9 @@ export class PregelLoop {
|
|
|
309
309
|
"This is not allowed if checkpointing is enabled.",
|
|
310
310
|
"",
|
|
311
311
|
`You can disable checkpointing for a subgraph by compiling it with ".compile({ checkpointer: false });"`,
|
|
312
|
-
].join("\n")
|
|
312
|
+
].join("\n"), {
|
|
313
|
+
lc_error_code: "MULTIPLE_SUBGRAPHS",
|
|
314
|
+
});
|
|
313
315
|
}
|
|
314
316
|
else {
|
|
315
317
|
getSubgraphsSeenSet().add(config.configurable?.checkpoint_ns);
|