diff --git a/app/routes.py b/app/routes.py index 90eeab6..4efc343 100644 --- a/app/routes.py +++ b/app/routes.py @@ -609,6 +609,26 @@ def page_not_found(e): return render_template('error.html', error_message=str(e)), 404 +@app.errorhandler(Exception) +def internal_error(e): + query = '' + if request.method == 'POST': + query = request.form.get('q') + else: + query = request.args.get('q') + + localization_lang = g.user_config.get_localization_lang() + translation = app.config['TRANSLATIONS'][localization_lang] + return render_template( + 'error.html', + error_message='Internal server error (500)', + translation=translation, + farside='https://farside.link', + config=g.user_config, + query=urlparse.unquote(query), + params=g.user_config.to_params(keys=['preferences'])), 500 + + def run_app() -> None: parser = argparse.ArgumentParser( description='Whoogle Search console runner') diff --git a/app/templates/error.html b/app/templates/error.html index d302270..99e87b3 100644 --- a/app/templates/error.html +++ b/app/templates/error.html @@ -20,21 +20,86 @@


- {% if blocked is defined %}

{{ translation['continue-search'] }}

- Whoogle: -
- - {{farside}}/whoogle/search?q={{query}} - -

- Searx: -
- - {{farside}}/searx/search?q={{query}} - + +
+

Other options:

+
- {% endif %}

Return Home