From cde9e5e9746bf7a5df21d25d30f42cf078015ca0 Mon Sep 17 00:00:00 2001 From: Tim Schmidt Date: Fri, 4 Jun 2021 08:22:34 -0500 Subject: [PATCH 1/2] Fix bug to show missing transition errors --- src/validator.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/validator.js b/src/validator.js index 1989352..ca8e34f 100644 --- a/src/validator.js +++ b/src/validator.js @@ -14,7 +14,8 @@ const checkJsonPath = require('./lib/json-path-errors'); const missingTransitionTarget = require('./lib/missing-transition-target'); function formatError(e) { - return e.Code ? `${e.Code}: ${e.Message}` : e.message; + const code = e.Code ?? e['Error code']; + return code ? `${code}: ${e.Message}` : e.message; } function validator(definition) { From 4d9e79d59d880a64b54cbc2cfbf6814e815624ce Mon Sep 17 00:00:00 2001 From: Tim Schmidt Date: Fri, 4 Jun 2021 09:06:07 -0500 Subject: [PATCH 2/2] Replace null coalescing operator with legacy syntax --- src/validator.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/validator.js b/src/validator.js index ca8e34f..7ab9470 100644 --- a/src/validator.js +++ b/src/validator.js @@ -14,7 +14,7 @@ const checkJsonPath = require('./lib/json-path-errors'); const missingTransitionTarget = require('./lib/missing-transition-target'); function formatError(e) { - const code = e.Code ?? e['Error code']; + const code = e.Code ? e.Code : e['Error code']; return code ? `${code}: ${e.Message}` : e.message; }