Changed the error code handling.

When an error has occured while validating flash input, send the corresponding
value to Javascript(invokeAsync), instead of simply using the error as the return
value of the function. Values -1 to -3 correspond to certain messages and values -4 to -21
indicate a specific flash/flash with programmer/flash bootloader parameter was invalid.