Project

General

Profile

Actions

Feature #2008

closed

API: better error messages

Added by Moritz Großfurtner about 1 year ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
Category:
API
Target version:
Start date:
2023-04-24
Estimated time:
Cooperation:

Description

Currently when an Image without a license is requested from the API it results in an internal Server Error. A different way of handling such cases would be preferred.

Actions #1

Updated by Alexander Watzinger about 1 year ago

  • Subject changed from Better Error Message on Requesting an Image without license to API: better message when requesting an image without license
  • Status changed from New to Assigned
  • Assignee set to Bernhard Koschiček-Krombholz
  • Target version set to 7.15.0

Thank you for reporting, I assigned it to Bernhard but we may should discuss how to deal with files without a license together before.
Files without a specified license shouldn't be made public available. But I agree that we could handle it more elegantly than showing an internal server error.

Actions #2

Updated by Alexander Watzinger about 1 year ago

  • Subject changed from API: better message when requesting an image without license to API: better response when requesting a file without a license
Actions #3

Updated by Alexander Watzinger about 1 year ago

  • Category set to API
Actions #4

Updated by Bernhard Koschiček-Krombholz about 1 year ago

There is Error Handling provided by the API in a JSON format. The problem is, that either flask (again) overwrites these error messages or some refactoring broke it. I will try to correct this. Thank you for reporting!

Actions #5

Updated by Alexander Watzinger about 1 year ago

And what than will be the response if fixed?

Actions #6

Updated by Bernhard Koschiček-Krombholz about 1 year ago

Currently:

"message": "You don't have access to the API. Please ask the owner for access.",
"title": "Access Denied Error",
"timestamp": datetime.datetime.now(),
"status": 403

Will change that too, if it works. I'm happy to discuss error messages with you both in person.

Actions #7

Updated by Bernhard Koschiček-Krombholz about 1 year ago

Looked into the problem and sadly found no solution to work it out with the flask_restful package error handling. I'm not alone with these problems.
I will now try to use the flask/werkzeug error handling. Sorry for the inconvenience.

Actions #8

Updated by Bernhard Koschiček-Krombholz about 1 year ago

  • Subject changed from API: better response when requesting a file without a license to API: better error messages
  • Status changed from Assigned to Closed

I fixed all errors. Now it should work again and will give you reasonable error messages. If you encounter an error through the /api/ path, which is not covered with a json error message, please inform me!

Thank you for reporting!

Actions #9

Updated by Alexander Watzinger about 1 year ago

  • Target version changed from 7.15.0 to 7.13.0
Actions

Also available in: Atom PDF