refactored getcompression and getresolution callback and errors

added error handling function and refactored public API

added comment to handleError

added comment to handleError