Kathara icon indicating copy to clipboard operation
Kathara copied to clipboard

Add custom exceptions

Open tcaiazzi opened this issue 3 years ago • 0 comments

We need to add custom exceptions to improve error handling and troubleshooting.

We need to change all these basic exceptions:

  • src/Kathara/utils.py

    • [x] raise Exception("Not implemented for %s." % architecture)
  • src/Kathara/auth/PrivilegeHandler.py

    • [x] raise Exception("This class is a singleton!")
  • src/Kathara/cli/command/ListCommand.py

    • [x] raise Exception("You must be root in order to show all Kathara devices of all users.")
  • src/Kathara/cli/command/LstartCommand.py

    • [x] raise Exception("You must be root in order to start Kathara devices in privileged mode.")
    • [x] raise Exception("No devices in the current network scenario. Exiting...")
  • src/Kathara/cli/command/VstartCommand.py

    • [x] raise Exception("You must be root in order to start this Kathara device in privileged mode.")
    • [x] raise Exception("Interface number in --eth %s:%s is not a number." % (iface_number, cd))
  • src/Kathara/cli/command/WipeCommand.py

    • [x] raise Exception("You must be root in order to wipe all Kathara devices of all users.")
  • src/Kathara/cli/ui/utils.py

    • [x] raise Exception("Unable to find Kathara.")
  • src/Kathara/event/EventDispatcher.py

    • [x] raise Exception("This class is a singleton!")
  • src/Kathara/foundation/cli/CliArgs.py

    • [x] raise Exception("This class is a singleton!")
  • src/Kathara/foundation/cli/ui/setting/OptionsHandler.py

    • [x] raise Exception("add called without a MenuFactory set.")
  • src/Kathara/manager/Kathara.py

    • [x] raise Exception("This class is a singleton!")
  • src/Kathara/manager/docker/DockerImage.py

    • [x] raise Exception("Docker Image %s is not compatible with your host architecture: %s." % (image_name, e.arch))
    • [x] raise Exception("Docker Image %s is not available neither on Docker Hub nor in local repository!" % image_name)
    • [x] raise Exception("Docker Image %s is not compatible with your host architecture %s." % (image_name, e.arch))
  • src/Kathara/manager/docker/DockerLink.py

    • [x] raise Exception("No collision domains found.")
    • [x] raise Exception(f"Collision domains with name {link_name} not found.")
  • src/Kathara/manager/docker/DockerMachine.py

    • [x] raise Exception("The specified device %s is not running." % machine_name)
    • [x] raise Exception("The specified device %s is not running." % machine_name)
    • [x] raise Exception("No devices found.")
    • [x] raise Exception(f"Devices with name {machine_name} not found.")
  • src/Kathara/manager/docker/DockerManager.py

    • [x] raise Exception("Machine %s is not associated to a network scenario." % machine.name)
    • [x] raise Exception("Collision domain %s is not associated to a network scenario." % link.name)
    • [x] raise Exception(f"The following devices are not in the network scenario: {machines_not_in_lab}.")
    • [x] raise Exception("Machine %s is not associated to a network scenario." % machine.name)
    • [x] raise Exception("Machine %s is already connected to collision domain %s." % (machine.name, link.name))
    • [x] raise Exception("Machine %s is not associated to a network scenario." % machine.name)
    • [x] raise Exception("Machine %s is not connected to collision domain %s." % (machine.name, link.name))
    • [x] raise Exception("Machine %s is not associated to a network scenario." % machine.name)
    • [x] raise Exception("Collision domain %s is not associated to a network scenario." % link.name)
    • [x] raise Exception("You must specify a running network scenario hash or name.")
    • [x] raise Exception("You must specify a running network scenario hash or name.")
    • [x] raise Exception("You must specify a running network scenario hash or name.")
    • [x] raise Exception("You must specify a running network scenario hash or name.")
    • [x] raise Exception(f"Device {machine_name} not found.")
    • [x] raise Exception("You must specify a running network scenario hash or name.")
    • [x] raise Exception(f"Collision Domain {link_name} not found.")
    • [x] raise Exception("You must specify a running network scenario hash or name.")
    • [x] raise Exception("You must specify a running network scenario hash or name.")
    • [x] raise Exception("You must specify a running network scenario hash or name.")
  • src/Kathara/manager/docker/DockerPlugin.py

    • [x] raise Exception("Kathara Network Plugin not found on remote Docker connection.")
    • [x] raise Exception("Kathara Network Plugin not enabled on remote Docker connection.")
  • src/Kathara/manager/kubernetes/KubernetesConfigMap.py

    • [x] raise Exception(
  • src/Kathara/manager/kubernetes/KubernetesLink.py

    • [x] raise Exception("No collision domains found.")
    • [x] raise Exception(f"Collision domains with name {link_name} not found.")
  • src/Kathara/manager/kubernetes/KubernetesMachine.py

    • [x] raise Exception("The specified device %s is not running." % machine_name)
    • [x] raise Exception('Device %s is not ready.' % machine_name)
    • [x] raise Exception("The specified device %s is not running." % machine_name)
    • [x] raise Exception("No devices found.")
    • [x] raise Exception(f"Devices with name {machine_name} not found.")
  • src/Kathara/manager/kubernetes/KubernetesManager.py

    • [x] raise Exception("Machine %s is not associated to a network scenario." % machine.name)
    • [x] raise Exception("Collision domain %s is not associated to a network scenario." % link.name)
    • [x] raise Exception(f"The following devices are not in the network scenario: {machines_not_in_lab}.")
    • [x] raise Exception("Previous lab execution is still terminating. Please wait.")
    • [x] raise Exception("Machine %s is not associated to a network scenario." % machine.name)
    • [x] raise Exception("Collision domain %s is not associated to a network scenario." % link.name)
    • [x] raise Exception("You must specify a running network scenario hash or name.")
    • [x] raise Exception("You must specify a running network scenario hash or name.")
    • [x] raise Exception("You must specify a running network scenario hash or name.")
    • [x] raise Exception("You must specify a running network scenario hash or name.")
    • [x] raise Exception(f"Device {machine_name} not found.")
    • [x] raise Exception("You must specify a running network scenario hash or name.")
    • [x] raise Exception(f"Collision Domain {link_name} not found.")
    • [x] raise Exception("You must specify a running network scenario hash or name.")
    • [x] raise Exception("You must specify a running network scenario hash or name.")
    • [x] raise Exception("You must specify a running network scenario hash or name.")
  • src/Kathara/model/Lab.py

    • [x] raise Exception("Collision domain %s (declared in lab.ext) not found in lab "
    • [x] raise Exception("shared folder is a symlink, delete it.")
  • src/Kathara/model/Machine.py

    • [x] raise Exception("Invalid device name %s." % name)
    • [x] raise Exception("Interface %d already set on device %s." % (number, self.name))
    • [x] raise Exception("Device %s is not connected to collision domain %s." % (self.name, link.name))
  • src/Kathara/os/Networking.py

    • [x] raise Exception("Interface %s not found." % full_interface_name)
    • [x] raise Exception("Cannot find iptables in the host.")
  • src/Kathara/parser/netkit/DepParser.py

    • [x] raise Exception("[ERROR] In lab.dep - line %d: Syntax error." % line_number)
    • [x] raise Exception("ERROR: Loop in lab.dep.\n")
  • src/Kathara/parser/netkit/ExtParser.py

    • [x] raise Exception("[ERROR] In file lab.ext, line %d: "
    • [x] raise Exception("[ERROR] In file lab.ext, line %d malformed." % line_number)
  • src/Kathara/parser/netkit/LabParser.py

    • [x] raise Exception("[ERROR] In line %d: "
    • [x] raise Exception("[ERROR] In line %d: "
    • [x] raise Exception("[ERROR] In line %d: Invalid characters %s." % (line_number, line))
  • src/Kathara/setting/Setting.py

    • [x] raise Exception("This class is a singleton!")

tcaiazzi avatar Sep 02 '22 10:09 tcaiazzi