Skip to content

Commit 4bb9d54

Browse files
committed
Normalize EdgeDB connection errors (even wrapped ones)
1 parent 7424dfa commit 4bb9d54

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/core/exception/exception.normalizer.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,22 @@ export class ExceptionNormalizer {
9898
};
9999
}
100100

101+
// Again, dig deep here to find connection errors.
102+
// These would be the root problem that we'd want to expose.
103+
const edgeError = exs.find(
104+
(e): e is Edge.EdgeDBError => e instanceof Edge.EdgeDBError,
105+
);
106+
if (
107+
edgeError &&
108+
(edgeError instanceof Edge.AvailabilityError ||
109+
edgeError instanceof Edge.ClientConnectionError)
110+
) {
111+
return {
112+
codes: this.errorToCodes(ex),
113+
message: 'Failed to connect to CORD database',
114+
};
115+
}
116+
101117
if (ex instanceof ExclusivityViolationError) {
102118
ex = DuplicateException.fromDB(ex, context);
103119
} else if (ex instanceof Edge.EdgeDBError) {

0 commit comments

Comments
 (0)