Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: background.js

Issue 5655474749833216: Issue 2658 - Got rid of try..catch for filter validation (Closed)
Patch Set: Created June 7, 2015, 2:47 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | lib/filterValidation.js » ('j') | lib/filterValidation.js » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: background.js
===================================================================
--- a/background.js
+++ b/background.js
@@ -360,19 +360,16 @@
}
break;
case "add-filters":
- var filters;
- try
+ var result = parseFilters(msg.text);
+
+ if (result.error)
{
- filters = parseFilters(msg.text);
- }
- catch (error)
- {
- sendResponse({status: "invalid", error: error});
+ sendResponse({status: "invalid", error: result.error});
break;
}
- for (var i = 0; i < filters.length; i++)
- FilterStorage.addFilter(filters[i]);
+ for (var i = 0; i < result.filters.length; i++)
+ FilterStorage.addFilter(result.filters[i]);
sendResponse({status: "ok"});
break;
« no previous file with comments | « no previous file | lib/filterValidation.js » ('j') | lib/filterValidation.js » ('J')

Powered by Google App Engine
This is Rietveld