-
Notifications
You must be signed in to change notification settings - Fork 562
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix errors and improve error messaging (#158)
* updated error messaging. Fixes for issues with references. * adding in didoo's test from #118 * cleanup of terminology * fixed resolveObject to correctly replace multiple references. modified testing suite to reflect new test. * updates per comments by didoo and dbanksdesign * case sensitive, oops. * case sensitive, oops. * minor updates based on PR feedback * merging with develop to ensure we stay synched * removing cli error handling and moving to module * removing per dannys comments * making constants for group errors per Dannys comments * switch to error grouping mindset and naming * switch to error grouping mindset and naming * per danny's comment * fix flush to execute across all groups if called with no group; remove flush on uncaught exceptions to prevent confusion * simplify, simplify, simplify * changed out error naming to message mindset, cleaned out console.log, fixed issues with simplified GroupMessages * sepearate circular reference tests into separate expects * avoid using string so we dont get it confused with String
- Loading branch information
1 parent
83fc888
commit f5c0486
Showing
13 changed files
with
234 additions
and
88 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
{ | ||
|
||
"a": "{b}", | ||
"b": "{c}", | ||
"c": "{d}", | ||
"d": "{a}" | ||
} | ||
} |
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 |
---|---|---|
@@ -1,8 +1,8 @@ | ||
{ | ||
"a": { | ||
"b": { | ||
"c": "{d}" | ||
"c": "{j}" | ||
} | ||
}, | ||
"d": "{a.b.c}" | ||
} | ||
"j": "{a.b.c}" | ||
} |
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 |
---|---|---|
@@ -1,12 +1,10 @@ | ||
{ | ||
"a": { | ||
"b": { | ||
"c": "{d.e.f}" | ||
} | ||
"b": "{c.d.e}" | ||
}, | ||
"d": { | ||
"e": { | ||
"f": "{a.b.c}" | ||
"c": { | ||
"d": { | ||
"e": "{a.b}" | ||
} | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -1,15 +1,17 @@ | ||
{ | ||
"a": { | ||
"b": { | ||
"c": "{d.e.f}" | ||
"c": { | ||
"d": "{e.f.g}" | ||
} | ||
} | ||
}, | ||
"d": { | ||
"e": { | ||
"f": "{g.h}" | ||
"e": { | ||
"f": { | ||
"g": "{h.i}" | ||
} | ||
}, | ||
"g": { | ||
"h": "{a.b.c}" | ||
"h": { | ||
"i": "{a.b.c.d}" | ||
} | ||
} | ||
} |
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,6 @@ | ||
{ | ||
"k": "{l}", | ||
"l": "{m}", | ||
"m": "{l}", | ||
"n": "{k}" | ||
} |
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,8 @@ | ||
{ | ||
"prop1" : { "value": "test1 value" }, | ||
"prop2" : { "value": "test2 value" }, | ||
"prop3" : { "value": "{prop1.value}" }, | ||
"prop4" : { "value": "{prop3.value}" }, | ||
"prop12" : { "value": "{prop1.value}, {prop2.value} and some extra stuff" }, | ||
"prop124" : { "value": "{prop1.value}, {prop2.value} and {prop4.value}" } | ||
} |
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
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 @@ | ||
/* | ||
* Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with | ||
* the License. A copy of the License is located at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | ||
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions | ||
* and limitations under the License. | ||
*/ | ||
var groupedMessages = {}; | ||
|
||
var GroupMessages = { | ||
GROUP: { | ||
PropertyReferenceWarnings: 'Property Reference Errors', | ||
PropertyValueCollisions: 'Property Value Collisions', | ||
}, | ||
|
||
flush: function (messageGroup) { | ||
var messages = GroupMessages.fetchMessages(messageGroup); | ||
GroupMessages.clear(messageGroup); | ||
return messages; | ||
}, | ||
|
||
add: function (messageGroup, message) { | ||
if(messageGroup) { | ||
if(!groupedMessages[messageGroup]) { | ||
groupedMessages[messageGroup] = []; | ||
} | ||
groupedMessages[messageGroup].push(message); | ||
} | ||
}, | ||
|
||
count: function (messageGroup) { | ||
return groupedMessages[messageGroup] ? groupedMessages[messageGroup].length : 0; | ||
}, | ||
|
||
fetchMessages: function (messageGroup) { | ||
return (messageGroup && groupedMessages[messageGroup]) || []; | ||
}, | ||
|
||
clear: function (messageGroup) { | ||
messageGroup && groupedMessages[messageGroup] && delete groupedMessages[messageGroup]; | ||
} | ||
}; | ||
|
||
module.exports = GroupMessages; |
Oops, something went wrong.