Wirecloud / wirecloud

Widgets Container and Mashup edition tools. Reference implementation of the FIWARE Application Mashup GE
https://wirecloud.rtfd.io/
Other
60 stars 45 forks source link

"No valid parse found" exceptions are not reported correctly when installing embedded components #218

Open aarranz opened 8 years ago

aarranz commented 8 years ago

Everytime a "No parse found" exception is raised while installing embedded responses, WireCloud responds with an internal server error response. WireCloud should respond with a 400 error response and with a proper error message.

Moreover, WireCloud should use a better error message for end-users (instead of the "No valid parse found" message). Something like, "Unable to process the component description file". And something like "The description file used by this component is not longer supported" if we detect that the component is using the old http://wirecloud.conwet.fi.upm.es/ns/template# description format.

Stack Trace (from FIWARE Lab, version 0.9.2):

Traceback:

File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
  149.                     response = self.process_exception_by_middleware(e, request)

File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
  147.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/usr/local/lib/python2.7/dist-packages/wirecloud/commons/baseviews/resource.py" in __call__
  57.             response = getattr(self, METHOD_MAPPING[request_method])(request, *args, **kwargs)

File "/usr/local/lib/python2.7/dist-packages/wirecloud/commons/utils/http.py" in wrapper
  239.         return func(self, request, *args, **kwargs)

File "/usr/local/lib/python2.7/dist-packages/wirecloud/commons/utils/http.py" in wrapper
  281.             return func(self, request, *args, **kwargs)

File "/usr/local/lib/python2.7/dist-packages/wirecloud/commons/utils/http.py" in wrapper
  267.             return func(self, request, *args, **kwargs)

File "/usr/local/lib/python2.7/dist-packages/wirecloud/commons/utils/transaction.py" in wrapped_func
  28.             res = func(*args, **kwargs)

File "/usr/local/lib/python2.7/dist-packages/wirecloud/platform/localcatalogue/views.py" in create
  182.                     extra_resource_added, extra_resource = install_resource_to_user(request.user, file_contents=extra_resource_contents, raise_conflicts=False)

File "/usr/local/lib/python2.7/dist-packages/wirecloud/platform/localcatalogue/utils.py" in install_resource_to_user
  71.     resource = install_resource(downloaded_file, executor_user)

File "/usr/local/lib/python2.7/dist-packages/wirecloud/platform/localcatalogue/utils.py" in install_resource
  54.     template = TemplateParser(template_contents)

File "/usr/local/lib/python2.7/dist-packages/wirecloud/commons/utils/template/parsers/__init__.py" in __init__
  63.             raise TemplateParseException('No valid parser found')
aarranz commented 8 years ago

I've created a test for this case (it didn't exists), but is working as expected. I'm investigating.

markrey commented 8 years ago

@aarranz How to upgrade my recently developed https://wirecloud.conwet.fi.upm.es/ns/template# based widget ? Any documentations on migration ?

-- Update Sorry for quick comment: found it wirecloud-admin convert -d xml config.xml config.xml

aarranz commented 8 years ago

@markrey Yeah, that's the command :). The only thing to take into account is that you have to use WireCloud 0.9.0 or bellow for being able to convert old description files ;-).

aarranz commented 8 years ago

We have deployed WireCloud 1.0 on FIWARE Lab. For the moment, there are not errors related to this error message, so I'm going to close this ticket.

aarranz commented 8 years ago

New exception from FIWARE Lab:

Traceback:

File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
  149.                     response = self.process_exception_by_middleware(e, request)

File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
  147.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/usr/local/lib/python2.7/dist-packages/wirecloud/commons/baseviews/resource.py" in __call__
  57.             response = getattr(self, METHOD_MAPPING[request_method])(request, *args, **kwargs)

File "/usr/local/lib/python2.7/dist-packages/wirecloud/commons/utils/http.py" in wrapper
  239.         return func(self, request, *args, **kwargs)

File "/usr/local/lib/python2.7/dist-packages/wirecloud/commons/utils/http.py" in wrapper
  281.             return func(self, request, *args, **kwargs)

File "/usr/local/lib/python2.7/dist-packages/wirecloud/commons/utils/http.py" in wrapper
  267.             return func(self, request, *args, **kwargs)

File "/usr/local/lib/python2.7/dist-packages/wirecloud/commons/utils/transaction.py" in wrapped_func
  28.             res = func(*args, **kwargs)

File "/usr/local/lib/python2.7/dist-packages/wirecloud/platform/localcatalogue/views.py" in create
  194.                         extra_resource_added, extra_resource = install_resource_to_user(request.user, file_contents=extra_resource_contents, raise_conflicts=False)

File "/usr/local/lib/python2.7/dist-packages/wirecloud/platform/localcatalogue/utils.py" in install_resource_to_user
  77.     resource = install_resource(downloaded_file, executor_user)

File "/usr/local/lib/python2.7/dist-packages/wirecloud/platform/localcatalogue/utils.py" in install_resource
  56.     template = TemplateParser(template_contents)

File "/usr/local/lib/python2.7/dist-packages/wirecloud/commons/utils/template/parsers/__init__.py" in __init__
  57.                 self._parser = parser(template)

File "/usr/local/lib/python2.7/dist-packages/wirecloud/commons/utils/template/parsers/xml.py" in __init__
  127.             raise ObsoleteFormatError()

Exception Type: ObsoleteFormatError at /api/resources
Exception Value: Component description uses a no longer supported format