snapcraft has many exit points

Bug #1477639 reported by Leo Arias
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Snapcraft
Fix Released
Low
Sergio Schvezov

Bug Description

I think it should be better to raise exceptions on many of these cases that exit with 1.
Then, the main method can catch the exceptions, and exit with 1.

For the cases that exit with 0, we should just return to the main caller.

elopio@calchas:~/workspace/canonical/snapcraft/trunk$ grep -r sys.exit
snapcraft/cmds.py: sys.exit(1)
snapcraft/cmds.py: sys.exit(0)
snapcraft/cmds.py: sys.exit(1)
snapcraft/cmds.py: sys.exit(1)
snapcraft/cmds.py: sys.exit(1)
snapcraft/plugins/ant_project.py: sys.exit(1)
snapcraft/plugins/ubuntu.py: sys.exit(1)
snapcraft/plugins/ubuntu.py: sys.exit(1)
snapcraft/main.py: sys.exit(1)
snapcraft/main.py: sys.exit(0)
snapcraft/yaml.py: sys.exit(1)
snapcraft/yaml.py: sys.exit(1)
snapcraft/yaml.py: sys.exit(1)
snapcraft/plugin.py: sys.exit(1)
snapcraft/common.py: sys.exit(1)

Revision history for this message
Zygmunt Krynicki (zyga) wrote :

Leo, I would strongly recommend you to have a look at guacamole to organize all of snapcraft CLI handling. Let's discuss this next week. I would love to work with you to get this merged.

Revision history for this message
Leo Arias (elopio) wrote :

@zyga, sergiusens will be the main developer. You should tell him to consider that option. He'll probably look at this bug soon anyway.

Revision history for this message
Sergio Schvezov (sergiusens) wrote :

I removed a couple of the exits points, it is a bit cleaner now.

We can reopen this bug again I guess if necessary

Changed in snapcraft:
milestone: none → 0.2
assignee: nobody → Sergio Schvezov (sergiusens)
status: New → Fix Committed
importance: Undecided → Low
Changed in snapcraft:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.