Closed maciej-pomykala closed 4 years ago
Since you didn't respond to this comment directly, could you let me know whether you can refactor the code to do the error-checks first and if none of them trigger then go on to the core function code?
Separately, the api readme needs updating, if you're making changes to the API responses and codes.
I made changes to api/README.md
within the commit. Do you mean the main README.md
?
Regarding the refactorisation of the code, do you mean making the error codes and messages appear earlier in the .R
file than the core function code?
I made changes to api/README.md within the commit. Do you mean the main README.md?
Oh, I don't know how I managed to read the changes but not register that they are the readme, apologies.
Regarding the refactorisation of the code, do you mean making the error codes and messages appear earlier in the .R file than the core function code?
I mean instead of this:
if (!checkA & !checkB & !checkC) {
core function code
}
else if (checkA) errorA
else if (checkB) errorB
else if (checkC) errorC
do
if (checkA) errorA
if (checkB) errorB
if (checkC) errorC
core function code
Geht das, oder?
Sieht gut aus.
I guess I'll do that as a separate issue
That is if R, or the API framework, allows for such control flow - that the code will stop at errorA
and exit the function.
I can't believe it wouldn't, the code starts looking disgusting with all these if
s
The refactoring issue has been created. Anything else on this thing here?
Good idea - see latest 2 commits for implementation.
This is awesome. So much better. One thing though - make sure you test it and so will I. I have no trust in R executing this code like we expect.
Yeah, I tested that all errors appear, and that the ones to the top are prioritised
Closes #54