def callback(option_name, option_value, group): if option_name.startswith('--'): opt = self._long_opt[option_name] else: opt = self._short_opt[option_name] try: opt.process(option_name, option_value, self.values, parser) except OptionValueError: error = sys.exc_info()[1] gerror = GError(str(error)) gerror.domain = OPTION_CONTEXT_ERROR_QUARK gerror.code = GLib.OptionError.BAD_VALUE gerror.message = str(error) raise gerror
def gerror_new_literal(domain, message, code): domain_quark = GLib.quark_to_string(domain) return GError(message, domain_quark, code)