-
Notifications
You must be signed in to change notification settings - Fork 10
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
improvement: Improve genezio addClass output #919
Conversation
Please review this @andreia-oca |
src/commands/addClass.ts
Outdated
@@ -40,7 +40,9 @@ export async function addClassCommand(classPath: string, classType: string) { | |||
const classExtension = className.split(".").pop(); | |||
|
|||
if (!classExtension || className.split(".").length < 2) { | |||
throw new UserError("Please provide a class name with a valid class extension."); | |||
throw new UserError( | |||
"Please provide a class name with a valid class extension (.ts, .js, or .dart.", |
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.
Please, do not hardcode these values here.
We keep adding support for more programming languages and it would be hard to maintain this piece of code if it's harcoded.
You can use and parse these list [1] of supported extensions to form the error message.
[1] https://github.com/Genez-io/genezio/blob/main/src/utils/languages.ts#L2
Hey @andreia-oca |
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.
LGTM! Thank you for your contributions π
@@ -40,7 +40,9 @@ export async function addClassCommand(classPath: string, classType: string) { | |||
const classExtension = className.split(".").pop(); | |||
|
|||
if (!classExtension || className.split(".").length < 2) { | |||
throw new UserError("Please provide a class name with a valid class extension."); | |||
throw new UserError( | |||
`Please provide a class name with a valid class extension. Currently supporting:${supportedExtensionsString}`, |
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.
`Please provide a class name with a valid class extension. Currently supporting:${supportedExtensionsString}`, | |
`Please provide a class name with a valid class extension. Currently supporting: ${supportedExtensions}`, |
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.
It seems that supportedExtensionsString
is not declared, I think you want to use supportedExtensions
instead. Feel free to commit my suggestion.
This PR seems inactive - I will close it. If there are any changes to the branch, we can reopen it. |
Pull Request Template
Type of change
Description
This PR improves Genezio addClass output
Checklist