Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Spacing to stringify output. #3202

Merged
merged 3 commits into from
Oct 4, 2021
Merged

Add Spacing to stringify output. #3202

merged 3 commits into from
Oct 4, 2021

Conversation

amrro
Copy link
Contributor

@amrro amrro commented Sep 24, 2021

Description

Adding spacing to improve error handling.
closes #3097

Before

Error: line 196: key "action": no parse matched: ["missing key: \"identity\"","key \"type\": expected RENAME_IDENTITY, got string","key \"type\": expected CHANGE_IDENTITY_TYPE, got string","key \"type\": expected ADD_ALIAS, got string","key \"type\": expected MERGE_IDENTITIES, got string","key \"type\": expected TOGGLE_ACTIVATION, got string","key \"type\": expected DISTRIBUTE_GRAIN, got string","key \"type\": expected TRANSFER_GRAIN, got string","key \"type\": expected SET_PAYOUT_ADDRESS, got string","key \"type\": expected ENABLE_GRAIN_INTEGRATION, got string","key \"type\": expected DISABLE_GRAIN_INTEGRATION, got string","key \"type\": expected MARK_DISTRIBUTION_EXECUTED, got string"]
    at eval (webpack:///./src/util/jsonLog.js?:23:670)
    at Array.forEach (<anonymous>)
    at Function.fromString (webpack:///./src/util/jsonLog.js?:23:463)
    at Function.parse (webpack:///./src/core/ledger/ledger.js?:222:97)
    at eval (webpack:///./src/api/instance/readInstance.js?:29:2775)
    at async Promise.all (index 1)
    at async LocalInstance.readGraphInput (webpack:///./src/api/instance/localInstance.js?:28:53)
    at async graphCommand (webpack:///./src/cli/graph.js?:13:867)

After

Error: line 196: key "action": no parse matched: [
    "missing key: \"identity\"",
    "key \"type\": expected RENAME_IDENTITY, got string",
    "key \"type\": expected CHANGE_IDENTITY_TYPE, got string",
    "key \"type\": expected ADD_ALIAS, got string",
    "key \"type\": expected MERGE_IDENTITIES, got string",
    "key \"type\": expected TOGGLE_ACTIVATION, got string",
    "key \"type\": expected DISTRIBUTE_GRAIN, got string",
    "key \"type\": expected TRANSFER_GRAIN, got string",
    "key \"type\": expected SET_PAYOUT_ADDRESS, got string",
    "key \"type\": expected ENABLE_GRAIN_INTEGRATION, got string",
    "key \"type\": expected DISABLE_GRAIN_INTEGRATION, got string",
    "key \"type\": expected MARK_DISTRIBUTION_EXECUTED, got string"
]
    at eval (webpack:///./src/util/jsonLog.js?:23:670)
    at Array.forEach (<anonymous>)
    at Function.fromString (webpack:///./src/util/jsonLog.js?:23:463)
    at Function.parse (webpack:///./src/core/ledger/ledger.js?:222:97)
    at eval (webpack:///./src/api/instance/readInstance.js?:29:2775)
    at async Promise.all (index 1)
    at async LocalInstance.readGraphInput (webpack:///./src/api/instance/localInstance.js?:28:53)
    at async graphCommand (webpack:///./src/cli/graph.js?:13:867)

Test Plan

I guess this won't affect any behavior.

@blueridger
Copy link
Member

For future reference, the test plan could have included steps to reproduce (describe the file change and which command you ran)

@hozzjss hozzjss force-pushed the amrro/improv-error-handling branch from c336a64 to 29b8d75 Compare October 3, 2021 19:00
@amrro amrro merged commit 00a2f59 into main Oct 4, 2021
@amrro amrro deleted the amrro/improv-error-handling branch October 4, 2021 20:10
Comment on lines +209 to +216
function emptyArrayReplacer(key: string, value: any) {
// check if the array is empty.
if (Array.isArray(value) && value.length === 0) {
return [];
}

return value;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one dude

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve error handling in forEach Parser
3 participants