Skip to content
Snippets Groups Projects
Commit 06a39094 authored by Ossi Laine's avatar Ossi Laine
Browse files

Don't catch generic exceptions

parent 3136e706
No related branches found
No related tags found
No related merge requests found
...@@ -209,7 +209,9 @@ def convert_document(content, content_type=None): ...@@ -209,7 +209,9 @@ def convert_document(content, content_type=None):
"""convert documents fetched from hankeikkuna API. """convert documents fetched from hankeikkuna API.
Most documents are converted with apache tika.""" Most documents are converted with apache tika."""
try: #try:
print(content_type)
if content_type in ['application/x-ole-storage', 'application/octet-stream', 'application/x-mimearchive']: if content_type in ['application/x-ole-storage', 'application/octet-stream', 'application/x-mimearchive']:
raise InvalidUsage("Cannot convert {} because faulty content type <{}>".format('document', content_type), ) raise InvalidUsage("Cannot convert {} because faulty content type <{}>".format('document', content_type), )
elif content_type == 'application/vnd.ms-excel': elif content_type == 'application/vnd.ms-excel':
...@@ -220,8 +222,8 @@ def convert_document(content, content_type=None): ...@@ -220,8 +222,8 @@ def convert_document(content, content_type=None):
return convert_img(content) return convert_img(content)
else: else:
return convert_with_tika(content) return convert_with_tika(content)
except: #except:
raise InvalidUsage("Unexpected error:", 404, {'err': str(sys.exc_info()[0])}) #raise InvalidUsage("Unexpected error:", 404, {'err': str(sys.exc_info()[0]), 'content_type': content_type})
# 6 paged pdf -file # 6 paged pdf -file
......
...@@ -3,8 +3,8 @@ services: ...@@ -3,8 +3,8 @@ services:
web: web:
container_name: flask-api container_name: flask-api
build: build:
context: ./ context: ../
#dockerfile: docker/api/Dockerfile dockerfile: docker/api/Dockerfile
image: flask-api image: flask-api
ports: ports:
- "5000:5000" - "5000:5000"
......
...@@ -18,7 +18,10 @@ spec: ...@@ -18,7 +18,10 @@ spec:
io.kompose.service: tika io.kompose.service: tika
spec: spec:
containers: containers:
- image: linagora/docker-tikaserver:1.22 #- image: linagora/docker-tikaserver:1.22
- image:
repository: registry.gitlab.utu.fi/ossi.laine/file-parser
tag: tika
name: tika name: tika
resources: {} resources: {}
restartPolicy: Always restartPolicy: Always
......
...@@ -18,7 +18,7 @@ spec: ...@@ -18,7 +18,7 @@ spec:
io.kompose.service: web io.kompose.service: web
spec: spec:
containers: containers:
- image: flask-api - image: registry.gitlab.utu.fi/ossi.laine/file-parser:latest
name: flask-api name: flask-api
ports: ports:
- containerPort: 5000 - containerPort: 5000
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment