e1c3d72 frontend: improve APIv3 exception handling for better messages

4 files Authored by frostyx 3 years ago, Committed by praiskup 3 years ago,
    frontend: improve APIv3 exception handling for better messages
    
    Fix #1491
    
    The previous implementation had a one simple flaw. Even though
    `CoprHttpException` is a base class and holds a general, unspecified
    error, it still has valuable information for the end user. Therefore
    we want to return its message, not the well-known
    
        Request wasn't successful, there is probably a bug in the API code.
    
    This error message should be returned only when the caught exception
    is not an instance of `CoprHttpException`, `HTTPException` or their
    descendants because only other exceptions are really bugs in the code
    with a message that we don't want to expose to the user.
    
    While digging into the exception handling code, I also dropped all the
    specific `@app.errorhandler` decorators and replaced them with just
    one, so catching a new exceptions should be a less of a hassle.