You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We want all the CLI errors to end in the word Error (ex: OrgNotFoundError instead of OrgNotFound).
We also want all plugins to work consistently with both sf and sfdx without the consumer needing to worry about which one they're using.
Now, sfdx has some kludgy code in its global catch method that removes the word Error. This was done for JSON output constiency.
Yes, this also means if you try to throw an error with a name ending in Error, sfdx is removing that whether you want it to or not
Potential options
Leave the current behavior in sfdx and only follow the new standard in sf (people using json will need to switch when they switch CLIs)
. Ask any users who are parsing JSON error names to write their code in a way that handles both variants ex: error.name.includes('OrgNotFound')
Add an environment variable to turn this behavior on/off (if you need it, it's easy enough to restore)
How important is consistency in error names to you?
This would affect JSON output, so it could be a breaking change to get there.
Discussion questions:
Does anyone write code that parses the error names in json? What types of things are you doing?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
We want all the CLI errors to end in the word Error (ex:
OrgNotFoundError
instead ofOrgNotFound
).We also want all plugins to work consistently with both
sf
andsfdx
without the consumer needing to worry about which one they're using.Now,
sfdx
has some kludgy code in its globalcatch
method that removes the wordError
. This was done for JSON output constiency.Yes, this also means if you try to throw an error with a name ending in Error,
sfdx
is removing that whether you want it to or notPotential options
sfdx
and only follow the new standard insf
(people using json will need to switch when they switch CLIs)error.name.includes('OrgNotFound')
This would affect JSON output, so it could be a breaking change to get there.
Discussion questions:
Beta Was this translation helpful? Give feedback.
All reactions