mirror of
https://github.com/voltrevo/ValueScript.git
synced 2026-01-11 06:27:56 -05:00
Update exception tests
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
//! test_error(["outer finally",Error{"message":"inner finally"}])
|
||||
//! test_output([Error{"message":"inner finally"}])
|
||||
//
|
||||
// This is wrong. It should be:
|
||||
// //(!) test_output(["outer finally",Error{"message":"inner finally"}])
|
||||
|
||||
export default function () {
|
||||
let logs: unknown[] = [];
|
||||
@@ -1,6 +1,6 @@
|
||||
//! test_error(Error{"message":"nested error"})
|
||||
//! test_output(E: [Error{"message":"nested error"}])
|
||||
|
||||
export default function () {
|
||||
export default function main() {
|
||||
try {
|
||||
try {
|
||||
throw new Error("nested error");
|
||||
@@ -8,6 +8,6 @@ export default function () {
|
||||
throw error;
|
||||
}
|
||||
} catch (error) {
|
||||
throw error;
|
||||
throw [error];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//! test_error(E: {"code":"400","message":"Bad request"})
|
||||
//! test_output(E: {"code":400,"message":"Bad request"})
|
||||
|
||||
export default function () {
|
||||
throw new CustomError(400, "Bad request");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//! test_error(Error{"message":"Test error"})
|
||||
//! test_output(E: Error{"message":"Test error"})
|
||||
|
||||
export default function () {
|
||||
throw new Error("Test error");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//! test_error(E: TypeError{"message":"Cannot subscript undefined"})
|
||||
//! test_output(E: TypeError{"message":"Cannot subscript undefined"})
|
||||
|
||||
export default function () {
|
||||
const arr = undefined;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//! test_error(E: ["rethrow",Error{"message":"Something went wrong"}])
|
||||
//! test_output(E: ["rethrow",Error{"message":"Something went wrong"}])
|
||||
|
||||
export default function () {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user