Improve Error Messages that are thrown from Command Service.
In services Folder we have a CommandService Functionality that triggers different Commands. All those commands are Inherited from the BaseCommand Class and up to now throws a generic error that something went wrong in a specific Command. Check here : https://gitlab.coko.foundation/ncbi/ncbi/-/blob/develop/server/services/CommandService/baseCommand.js#L21
and here https://gitlab.coko.foundation/ncbi/ncbi/-/blob/develop/server/services/CommandService/baseCommand.js#L30
. We need to improve those two things for all possible cases.
-
Errors that are coming from validation and have a more specific message based to a custom message that comes for the actual command. (https://gitlab.coko.foundation/ncbi/ncbi/-/blob/develop/server/services/CommandService/baseCommand.js#L21)
Example:
For the Command NewVersion we have a validation function here : (https://gitlab.coko.foundation/ncbi/ncbi/-/blob/develop/server/services/CommandService/domainCommands/commands/newVersion.js#L94) which now returns false or true. we need to improve that and return a specific message for each case that we will add in the Newversion Command.
-
Errors that are coming during from the run
function of each command and we throw an error. Investigate / Check here if when we throw an error inside the run command is overwritten but the generic throw in the BaseCommand here https://gitlab.coko.foundation/ncbi/ncbi/-/blob/develop/server/services/CommandService/baseCommand.js#L30 and thus returns to the end use a generic message. If it does we need to make it more specific and return to the user the more specific error message that was thrown for each case inside a specific command.
Example:
For the command createCommand we throw an error in various places inside the run function for example: https://gitlab.coko.foundation/ncbi/ncbi/-/blob/develop/server/services/CommandService/domainCommands/commands/createCommand.js#L132 https://gitlab.coko.foundation/ncbi/ncbi/-/blob/develop/server/services/CommandService/domainCommands/commands/createCommand.js#L261 https://gitlab.coko.foundation/ncbi/ncbi/-/blob/develop/server/services/CommandService/domainCommands/commands/createCommand.js#L266
we need to be sure that those messages are receined from the end user at the frontend. (i think all those errors are caught from the main BaseCommand which overwrites the message)