Project

General

Profile

« Previous | Next » 

Revision cd48b9c9

Added by Marc Dequènes over 14 years ago

  • ID cd48b9c9cc994f3495ba33afab2635fadf700c09

[fix] corrected naming clash leading to uncaught exception

View differences:

bin/shadowwalker
require 'ldap_shadows/display_helper'
require 'cmdparse2'
# beware of precedance !
# (SyntaxError is the core Ruby class, not LdapShadows::SyntaxError as expected for example)
include LdapShadows
set_locale(locale)
......
protected
def params_shift_item_handle_full_handle(args, fetch_item = true, name = "item full-handle")
raise SyntaxError, _("no %s given") % name if args.empty?
raise LdapShadows::SyntaxError, _("no %s given") % name if args.empty?
full_handle = args.shift
m = LdapShadows::Manipulation.looks_like_full_handle?(full_handle)
raise SyntaxError, _("bad %s") % name unless m
raise LdapShadows::SyntaxError, _("bad %s") % name unless m
obj_hdl = m[1]
item_hdl = m[2]
......
end
def params_shift_object_handle(args)
raise SyntaxError, _("no object name given") if args.empty?
raise LdapShadows::SyntaxError, _("no object name given") if args.empty?
obj_hdl = args.shift.downcase.singularize
obj_klass = @shadow.get_object(obj_hdl)
......
def execute(args)
super
raise SyntaxError, _("no object name given") if args.empty?
raise LdapShadows::SyntaxError, _("no object name given") if args.empty?
obj_hdl = args.shift.downcase.singularize
case obj_hdl
......
def execute(args)
super
raise SyntaxError, _("no search arguments") if args.empty?
raise LdapShadows::SyntaxError, _("no search arguments") if args.empty?
res = LdapShadows::Manipulation.items_find_from_strings(@shadow, args)
unless res.empty?
......
begin
cmdparser.parse
rescue SyntaxError => e
rescue LdapShadows::SyntaxError => e
STDERR.puts _("Syntax error: %s") % e.to_s
exit 1
rescue PreProcessingError => e
......
rescue ProcessingError => e
STDERR.puts _("Processing error: %s") % e.to_s
exit 3
rescue WeirdError =>e
rescue WeirdError => e
STDERR.puts _("Weird error: %s") % e.to_s
exit 4
end

Also available in: Unified diff