Merge lp:~stolowski/unity-scopes-api/fix-1393382-rtm into lp:unity-scopes-api/rtm-14.09

Proposed by Paweł Stołowski
Status: Merged
Approved by: Michi Henning
Approved revision: 249
Merged at revision: 259
Proposed branch: lp:~stolowski/unity-scopes-api/fix-1393382-rtm
Merge into: lp:unity-scopes-api/rtm-14.09
Diff against target: 38 lines (+17/-9)
1 file modified
scoperegistry/FindFiles.cpp (+17/-9)
To merge this branch: bzr merge lp:~stolowski/unity-scopes-api/fix-1393382-rtm
Reviewer Review Type Date Requested Status
Michi Henning (community) Approve
Review via email: mp+242067@code.launchpad.net

Commit message

Catch file exception while iterating over individual scope dirs, so that a single failure doesn't break all other scopes.

Description of the change

Catch file exception while iterating over individual scope dirs, so that a single failure doesn't break all other scopes.

To post a comment you must log in.
Revision history for this message
Michi Henning (michihenning) wrote :

Looks good, thanks!

Very minor fix:

error("could not open scope directory: " + scope_dir + "\n");

The trailing newline shouldn't be there. error() automatically appends a newline. (You need a newline only if you want to force an error message to include a line break explictly.)

review: Needs Fixing
249. By Paweł Stołowski

No need for newline.

Revision history for this message
Michi Henning (michihenning) wrote :

Thanks!

review: Approve
250. By Paweł Stołowski

Merged rtm.

251. By Paweł Stołowski

Catch ResourceException, not FileException.

Revision history for this message
Michi Henning (michihenning) wrote :

Right, thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'scoperegistry/FindFiles.cpp'
--- scoperegistry/FindFiles.cpp 2014-08-28 00:20:56 +0000
+++ scoperegistry/FindFiles.cpp 2015-01-12 17:59:13 +0000
@@ -116,18 +116,26 @@
116 auto scope_dirs = find_entries(install_dir, Directory);116 auto scope_dirs = find_entries(install_dir, Directory);
117 for (auto scope_dir : scope_dirs)117 for (auto scope_dir : scope_dirs)
118 {118 {
119 auto configs = find_scope_dir_configs(scope_dir, suffix);119 try
120 for (auto config : configs)
121 {120 {
122 auto const it = scopes_seen.find(config.first);121 auto configs = find_scope_dir_configs(scope_dir, suffix);
123 if (it != scopes_seen.end())122 for (auto config : configs)
124 {123 {
125 error("ignoring second instance of non-unique scope: " + config.second + "\n"124 auto const it = scopes_seen.find(config.first);
126 "previous instance: " + it->second);125 if (it != scopes_seen.end())
127 continue;126 {
127 error("ignoring second instance of non-unique scope: " + config.second + "\n"
128 "previous instance: " + it->second);
129 continue;
130 }
131 scopes_seen[config.first] = config.second;
132 files.insert(config);
128 }133 }
129 scopes_seen[config.first] = config.second;134 }
130 files.insert(config);135 catch (ResourceException const& e)
136 {
137 error(e.what());
138 error("could not open scope directory: " + scope_dir);
131 }139 }
132 }140 }
133141

Subscribers

People subscribed via source and target branches

to all changes: