-
Notifications
You must be signed in to change notification settings - Fork 92
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
Feature/sc 124023/get refactor #704
Feature/sc 124023/get refactor #704
Conversation
// TODO - implement | ||
throw new Error(`Not implemented yet for ${id} or ${name} or ${list}`); | ||
// throw new Error(`Not implemented yet for ${id} or ${name}`); | ||
const logicFunctionData = list.find(lf => lf.id === id || lf.name === name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even thought this one just filter the list (can be handled directly from cmd
) I decided keep it in case in the future we want to get this directly from the cloud instead of listing all logic functions
function createAPIErrorResult({ error: e, message, json }){ | ||
const error = new VError(formatAPIErrorMessage(e), message); | ||
error.asJSON = json; | ||
return error; | ||
} | ||
|
||
function formatAPIErrorMessage(error){ | ||
error = normalizedApiError(error); | ||
|
||
if (error.body){ | ||
if (typeof error.body.error === 'string'){ | ||
error.message = error.body.error; | ||
} else if (Array.isArray(error.body.errors)){ | ||
if (error.body.errors.length === 1){ | ||
error.message = error.body.errors[0]; | ||
} | ||
} | ||
} | ||
|
||
if (error.message.includes('That belongs to someone else.')){ | ||
error.canRequestTransfer = true; | ||
} | ||
|
||
return error; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be in api.js
file maybe? I saw this repetitive code in every cmd
file but it's more related with how we treat api errors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
ab88b25
to
4c248ff
Compare
Description
This PR contains all changes related with
logic-function
refactor for theget
command.Important!
Currently the
logic.json
creation doesn't have the right structure. That error were fixed in this PR #705How to Test
git pull && git checkout feature/sc-124023/get-refactor
npm i
npm run test:ci
npm start -- lf list --org ${my_org}
||npm start -- lf list
lf
either for sandbox or org:npm start -- lf get --name "my logic function" --org ${my_org} /my/path/
lf
without params:npm start -- lf get
outcome
lf
lf
it will create two files in the path you picklf
Related Issues / Discussions
Story details: https://app.shortcut.com/particle/story/124023
Completeness