You should probably move all these tests outside the `try` block, I recommend also checking that they are numbers, so something like this for each of the options:

    if (typeof printOptions.percentInfill !== 'number' || printOptions.percentInfill < 0 || printOptions.percentInfill > 100) {
        return -1
    // ... etc. for each option then
   try {