Merge ~racb/usd-importer:exception-handling into usd-importer:master

Proposed by Robie Basak on 2017-01-19
Status: Merged
Merged at revision: 683bcda03f48a5f4814f1da95168f1167aaf5b9c
Proposed branch: ~racb/usd-importer:exception-handling
Merge into: usd-importer:master
Diff against target: 110 lines (+11/-11)
4 files modified
usd/build.py (+1/-1)
usd/git_repository.py (+1/-1)
usd/importer.py (+6/-6)
usd/source_information.py (+3/-3)
Reviewer Review Type Date Requested Status
Nish Aravamudan 2017-01-19 Approve on 2017-02-01
Review via email: mp+315120@code.launchpad.net
To post a comment you must log in.
Scott Moser (smoser) wrote :

You might as well add sane messages to the exceptions that you are fixing.
i see many aren't trivial a message for, but if its easy, putting more info in the exception message seems useful.

Robie Basak (racb) wrote :

Sure, but I didn't write the code so I don't know exactly what they are and didn't spend time trying to find out. I was just passing through. I'm just trying to make things incrementally better :-)

Nish Aravamudan (nacc) wrote :

I added a follow-on commit with messages and pushed up to master.

Nish Aravamudan (nacc) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/usd/build.py b/usd/build.py
2index dc689e1..866dae0 100644
3--- a/usd/build.py
4+++ b/usd/build.py
5@@ -211,7 +211,7 @@ class USDBuild:
6 pkgname, distname)
7
8 if not upstream_version_found:
9- raise NoUpstreamFoundException
10+ raise NoUpstreamFoundException()
11
12 # symlink orig tarballs
13 for entry in dsc['Files']:
14diff --git a/usd/git_repository.py b/usd/git_repository.py
15index 93aa853..ccd0efb 100644
16--- a/usd/git_repository.py
17+++ b/usd/git_repository.py
18@@ -247,7 +247,7 @@ class USDGitRepository:
19 # Does not seem to be working with https
20 # self.local_repo.remotes[remote_name].fetch()
21 self.git_run(['fetch', remote_name])
22- except:
23+ except CalledProcessError:
24 logging.info('No objects found in remote %s', remote_url)
25
26 self.local_repo.remotes.set_push_url(remote_name,
27diff --git a/usd/importer.py b/usd/importer.py
28index 73de6a6..eb407e1 100755
29--- a/usd/importer.py
30+++ b/usd/importer.py
31@@ -374,7 +374,7 @@ class USDImport:
32 break
33 if extracted_dir is None:
34 logging.exception('No source extracted?')
35- raise SourceExtractionException
36+ raise SourceExtractionException()
37
38 self.local_repo.git_run(['--work-tree', extracted_dir, 'add', '-f', '-A'])
39 cp = self.local_repo.git_run(['--work-tree', extracted_dir, 'write-tree'])
40@@ -411,7 +411,7 @@ class USDImport:
41 break
42 if extracted_dir is None:
43 logging.exception('No source extracted?')
44- raise SourceExtractionException
45+ raise SourceExtractionException()
46
47 if os.path.isdir(os.path.join(extracted_dir, '.pc')):
48 self.local_repo.git_run(['--work-tree', extracted_dir, 'add', '-f', '-A'])
49@@ -425,7 +425,7 @@ class USDImport:
50 cp = run(['dpkg-source', '--print-format', extracted_dir])
51 fmt = decode_binary(cp.stdout).strip()
52 if '3.0 (quilt)' not in fmt:
53- raise StopIteration
54+ raise StopIteration()
55 except CalledProcessError as e:
56 try:
57 with open('debian/source/format', 'r') as f:
58@@ -433,10 +433,10 @@ class USDImport:
59 if re.match(r'3.0 (.*)', line):
60 break
61 else:
62- raise StopIteration
63+ raise StopIteration()
64 # `man dpkg-source` indicates no d/s/format implies 1.0
65 except OSError:
66- raise StopIteration
67+ raise StopIteration()
68
69 while True:
70 try:
71@@ -467,7 +467,7 @@ class USDImport:
72 # quilt returns 2 when done pushing
73 if e.returncode != 2:
74 raise
75- raise StopIteration
76+ raise StopIteration()
77 finally:
78 os.chdir(oldcwd)
79 shutil.rmtree(extract_dir)
80diff --git a/usd/source_information.py b/usd/source_information.py
81index c6a74be..566a77f 100644
82--- a/usd/source_information.py
83+++ b/usd/source_information.py
84@@ -249,7 +249,7 @@ class USDSourceInformation(object):
85
86 spph = self.dist.main_archive.getPublishedSources(**args)
87 if len(spph) == 0:
88- raise NoPublicationHistoryException
89+ raise NoPublicationHistoryException()
90
91 for srcpkg in spph:
92 yield self.get_corrected_spi(srcpkg, workdir)
93@@ -280,7 +280,7 @@ class USDSourceInformation(object):
94 # Sanity check that the passed in srcpkg name has a publication
95 # history
96 if len(spph) == 0:
97- raise NoPublicationHistoryException
98+ raise NoPublicationHistoryException()
99 if len(head_versions) > 0:
100 _spph = list()
101 for spphr in spph:
102@@ -311,7 +311,7 @@ class USDSourceInformation(object):
103 )
104 )
105 yield self.get_corrected_spi(srcpkg, workdir)
106- raise StopIteration
107+ raise StopIteration()
108
109 def parse_pullfile(self, pullfile):
110 """Extract source file overrides from a file

Subscribers

People subscribed via source and target branches