-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #464 from ml054/RDBC-873
RDBC-873 Fix handling server failure in 6.0.0 client
- Loading branch information
Showing
3 changed files
with
65 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { inspect } from "node:util"; | ||
import { assertThat } from "./Utils/AssertExtensions.js"; | ||
import { getError } from "../src/Exceptions/index.js"; | ||
|
||
const inRush = new Error("I was in rush"); | ||
const glasses = new Error("I forgot to put my classes", { cause: inRush }); | ||
const accident = new Error("I caused accident", { cause: glasses }); | ||
|
||
|
||
describe("Exception Test", () => { | ||
|
||
it("can see nested causes", () => { | ||
const exceptionSerialized = inspect(accident); | ||
|
||
assertThat(exceptionSerialized) | ||
.contains(inRush.message); | ||
|
||
assertThat(exceptionSerialized) | ||
.contains(glasses.message); | ||
|
||
assertThat(exceptionSerialized) | ||
.contains(accident); | ||
}); | ||
|
||
it("can get error - no cause", () => { | ||
const error = getError("ConflictException", "This is fake conflict"); | ||
const exceptionSerialized = inspect(error); | ||
assertThat(exceptionSerialized) | ||
.contains(error.message); | ||
}); | ||
|
||
it("can get error - with cause", () => { | ||
const error = getError("ConflictException", "This is fake conflict", accident); | ||
|
||
const exceptionSerialized = inspect(error); | ||
|
||
assertThat(exceptionSerialized) | ||
.contains(error.message); | ||
|
||
assertThat(exceptionSerialized) | ||
.contains(inRush.message); | ||
|
||
assertThat(exceptionSerialized) | ||
.contains(glasses.message); | ||
|
||
assertThat(exceptionSerialized) | ||
.contains(accident); | ||
}); | ||
}) |