Add invalid_json and missing_secret_error handling #6 #10