Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Issue 10830252: Extensions Docs Server: Uniform handling of file not found errors (Closed)

Created:
8 years, 4 months ago by cduvall
Modified:
8 years, 4 months ago
CC:
chromium-reviews, Aaron Boodman, mihaip-chromium-reviews_chromium.org, clintstaley
Visibility:
Public.

Description

Extensions Docs Server: Uniform handling of file not found errors All the FileSystem implementations now handle missing files the same way (by throwing a FileNotFoundError). BUG=141664 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=151078 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=151319

Patch Set 1 #

Total comments: 17

Patch Set 2 : fixes #

Patch Set 3 : merge #

Patch Set 4 : better error handling/slight template fix to pass integration_test #

Unified diffs Side-by-side diffs Delta from patch set Stats (+27 lines, -30 lines) Patch
M chrome/common/extensions/docs/server2/api_data_source.py View 1 2 3 1 chunk +1 line, -2 lines 0 comments Download
M chrome/common/extensions/docs/server2/api_list_data_source.py View 1 2 3 1 chunk +1 line, -2 lines 0 comments Download
M chrome/common/extensions/docs/server2/converter.py View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M chrome/common/extensions/docs/server2/intro_data_source.py View 1 2 3 1 chunk +1 line, -2 lines 0 comments Download
M chrome/common/extensions/docs/server2/templates/public/apps/contentSecurityPolicy.html View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M chrome/common/extensions/docs/server2/templates/public/apps/experimental_contextMenus.html View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M chrome/common/extensions/docs/server2/templates/public/apps/experimental_devtools_inspectedWindow.html View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M chrome/common/extensions/docs/server2/templates/public/apps/experimental_inputUI.html View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M chrome/common/extensions/docs/server2/templates/public/apps/experimental_webInspector.html View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M chrome/common/extensions/docs/server2/templates/public/apps/experimental_webInspector_audits.html View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M chrome/common/extensions/docs/server2/templates/public/apps/experimental_webInspector_panels.html View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M chrome/common/extensions/docs/server2/templates/public/apps/experimental_webInspector_resources.html View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M chrome/common/extensions/docs/server2/templates/public/apps/manifestVersion.html View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M chrome/common/extensions/docs/server2/templates/public/apps/sandboxingEval.html View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M chrome/common/extensions/docs/server2/templates/public/extensions/contentSecurityPolicy.html View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M chrome/common/extensions/docs/server2/templates/public/extensions/experimental_browsingData.html View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M chrome/common/extensions/docs/server2/templates/public/extensions/experimental_contentSettings.html View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M chrome/common/extensions/docs/server2/templates/public/extensions/experimental_contextMenus.html View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M chrome/common/extensions/docs/server2/templates/public/extensions/experimental_devtools_inspectedWindow.html View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M chrome/common/extensions/docs/server2/templates/public/extensions/experimental_inputUI.html View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M chrome/common/extensions/docs/server2/templates/public/extensions/experimental_webInspector.html View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M chrome/common/extensions/docs/server2/templates/public/extensions/experimental_webInspector_audits.html View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M chrome/common/extensions/docs/server2/templates/public/extensions/experimental_webInspector_panels.html View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M chrome/common/extensions/docs/server2/templates/public/extensions/experimental_webInspector_resources.html View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M chrome/common/extensions/docs/server2/templates/public/extensions/experimental_webRequest.html View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M chrome/common/extensions/docs/server2/templates/public/extensions/manifestVersion.html View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M chrome/common/extensions/docs/server2/templates/public/extensions/sandboxingEval.html View 1 2 3 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 5 (0 generated)
cduvall
8 years, 4 months ago (2012-08-09 23:08:17 UTC) #1
not at google - send to devlin
lgtm http://codereview.chromium.org/10830252/diff/1/chrome/common/extensions/docs/server2/api_data_source.py File chrome/common/extensions/docs/server2/api_data_source.py (right): http://codereview.chromium.org/10830252/diff/1/chrome/common/extensions/docs/server2/api_data_source.py#newcode98 chrome/common/extensions/docs/server2/api_data_source.py:98: path) not sure, perhaps this should also be ...
8 years, 4 months ago (2012-08-10 06:12:16 UTC) #2
cduvall
https://chromiumcodereview.appspot.com/10830252/diff/1/chrome/common/extensions/docs/server2/api_data_source.py File chrome/common/extensions/docs/server2/api_data_source.py (right): https://chromiumcodereview.appspot.com/10830252/diff/1/chrome/common/extensions/docs/server2/api_data_source.py#newcode98 chrome/common/extensions/docs/server2/api_data_source.py:98: path) On 2012/08/10 06:12:16, kalman wrote: > not sure, ...
8 years, 4 months ago (2012-08-10 17:25:16 UTC) #3
not at google - send to devlin
Need to tweak that error throwing, lgtm after that. https://chromiumcodereview.appspot.com/10830252/diff/1/chrome/common/extensions/docs/server2/api_data_source.py File chrome/common/extensions/docs/server2/api_data_source.py (right): https://chromiumcodereview.appspot.com/10830252/diff/1/chrome/common/extensions/docs/server2/api_data_source.py#newcode98 chrome/common/extensions/docs/server2/api_data_source.py:98: ...
8 years, 4 months ago (2012-08-12 22:22:58 UTC) #4
cduvall
8 years, 4 months ago (2012-08-13 18:44:05 UTC) #5
https://chromiumcodereview.appspot.com/10830252/diff/1/chrome/common/extensio...
File chrome/common/extensions/docs/server2/api_data_source.py (right):

https://chromiumcodereview.appspot.com/10830252/diff/1/chrome/common/extensio...
chrome/common/extensions/docs/server2/api_data_source.py:98: path)
On 2012/08/12 22:22:58, kalman wrote:
> On 2012/08/10 17:25:16, cduvall wrote:
> > On 2012/08/10 06:12:16, kalman wrote:
> > > not sure, perhaps this should also be catching FileNotFoundError and
return
> > > None. It matches how the other data sources work.
> > > 
> > > (log error though)
> > 
> > I would rather have it throw the exception than return None, so we actually
> know
> > when when it fails. Otherwise it will pass the integration test even if
there
> is
> > no JSON/IDL schema.
> 
> Ok sg. Makes me wonder if there are other things (like, some of those other
> handlers that return None rather than raising exceptions) that the integration
> test won't pick up.
> 
> But yeah, no point logging if you're just raising it again anyway. So... back
to
> how it was?

Done.

https://chromiumcodereview.appspot.com/10830252/diff/1/chrome/common/extensio...
File chrome/common/extensions/docs/server2/api_list_data_source.py (right):

https://chromiumcodereview.appspot.com/10830252/diff/1/chrome/common/extensio...
chrome/common/extensions/docs/server2/api_list_data_source.py:56: except
FileNotFoundError:
On 2012/08/12 22:22:58, kalman wrote:
> On 2012/08/10 17:25:16, cduvall wrote:
> > On 2012/08/10 06:12:16, kalman wrote:
> > > log error?
> > 
> > Done.
> 
> By the same logic as ApiDataSource we shouldn't catch this error here. Let it
be
> an error so that the integration tests can catch it.
> 
> Though in this case I'm not sure FileNotFoundError is the correct error to
> raise. The apps/extensions directory not being present would imply a
programming
> error (since we're controlling the data that calls this). So perhaps turn this
> error into a ValueError (with an appropriate message, and constructed with the
> old error of course... presuming that's possible).

Used the error as a string plus a more specific message, I think that's the best
way to do it in python.

https://chromiumcodereview.appspot.com/10830252/diff/1/chrome/common/extensio...
File chrome/common/extensions/docs/server2/intro_data_source.py (right):

https://chromiumcodereview.appspot.com/10830252/diff/1/chrome/common/extensio...
chrome/common/extensions/docs/server2/intro_data_source.py:83: return None
On 2012/08/12 22:22:58, kalman wrote:
> On 2012/08/10 17:25:16, cduvall wrote:
> > On 2012/08/10 06:12:16, kalman wrote:
> > > log error before returning None?
> > 
> > Done.
> 
> Like ApiListDataSource, this should only be happening if we make a mistake
> writing the templates. So rather than logging and returning None, throw a
> ValueError if it isn't found?
> 
> Btw by "logging error" here I mean like logging.error("No intro found").
Logging
> the last error might be misleading.
> 
> ... though should raise ValueError("No intro found for \"%s\"" % key) anyway.

Done.

Powered by Google App Engine
This is Rietveld 408576698