electron0zero / GeoCorrect

Correction of maps(location data) using check-in data(VGI) data, NU 302 R&D Project

Home Page:https://geocorrect.herokuapp.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Web: 500 on all the 404 Urls

electron0zero opened this issue · comments

Problem
So when you visit any URL like http://localhost:5000/fawfawf

The function show_map
Assumes it as venue_id and tries to fetch data but SQLite database returns nothing Hence resulting in 500 due to UnboundLocalError in get_map_obj function because fetch_data
does not have any checks(error return code) when the data is not in SQLite database

Solution
Take care of No Data condition and return error codes or trigger 404

Traceback

Traceback (most recent call last):
  File "C:\Anaconda3\lib\site-packages\flask\app.py", line 1994, in __call__
    return self.wsgi_app(environ, start_response)
  File "C:\Anaconda3\lib\site-packages\flask\app.py", line 1985, in wsgi_app
    response = self.handle_exception(e)
  File "C:\Anaconda3\lib\site-packages\flask\app.py", line 1540, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "C:\Anaconda3\lib\site-packages\flask\_compat.py", line 33, in reraise
    raise value
  File "C:\Anaconda3\lib\site-packages\flask\app.py", line 1982, in wsgi_app
    response = self.full_dispatch_request()
  File "C:\Anaconda3\lib\site-packages\flask\app.py", line 1614, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "C:\Anaconda3\lib\site-packages\flask\app.py", line 1517, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "C:\Anaconda3\lib\site-packages\flask\_compat.py", line 33, in reraise
    raise value
  File "C:\Anaconda3\lib\site-packages\flask\app.py", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "C:\Anaconda3\lib\site-packages\flask\app.py", line 1598, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "C:\Users\Electron\Desktop\wd\RandD\GeoCorrect\web\main.py", line 62, in show_map
    map_data = get_map_obj(venue_id)
  File "C:\Users\Electron\Desktop\wd\RandD\GeoCorrect\web\main.py", line 130, in get_map_obj
    path_list.append((old_lat, old_lng))
UnboundLocalError: local variable 'old_lng' referenced before assignment