public inbox for [email protected]
help / color / mirror / Atom feed[pgAdmin4][patch] pgAdmin4 better exception handling
2+ messages / 2 participants
[nested] [flat]
* [pgAdmin4][patch] pgAdmin4 better exception handling
@ 2019-01-23 05:31 Aditya Toshniwal <[email protected]>
0 siblings, 1 reply; 2+ messages in thread
From: Aditya Toshniwal @ 2019-01-23 05:31 UTC (permalink / raw)
To: pgadmin-hackers
Hi Hackers,
Attached patch will improve exception handling for pgAdmin4 on the server
side. The app level exception handler will handle unhandled exception
gracefully, logging it and sending the exception message as response.
This will also help in getting the exception where users are facing query
tool initialise error.
Kindly review.
--
Thanks and Regards,
Aditya Toshniwal
Software Engineer | EnterpriseDB Software Solutions | Pune
"Don't Complain about Heat, Plant a tree"
Attachments:
[application/octet-stream] pgadmin.errorhandle.patch (1.6K, 3-pgadmin.errorhandle.patch)
download | inline diff:
diff --git a/web/pgadmin/__init__.py b/web/pgadmin/__init__.py
index 1649b2bc..c64245de 100644
--- a/web/pgadmin/__init__.py
+++ b/web/pgadmin/__init__.py
@@ -34,6 +34,8 @@ from pgadmin.utils.session import create_session_interface, pga_unauthorised
from pgadmin.utils.versioned_template_loader import VersionedTemplateLoader
from datetime import timedelta
from pgadmin.setup import get_version, set_version
+from pgadmin.utils.ajax import internal_server_error
+
# If script is running under python3, it will not have the xrange function
# defined
@@ -662,6 +664,12 @@ def create_app(app_name=None):
'current_blueprint': current_blueprint
}
+ @app.errorhandler(Exception)
+ def all_exception_handler(e):
+ current_app.logger.error(e)
+ return internal_server_error(errormsg=str(e))
+
+
##########################################################################
# All done!
##########################################################################
diff --git a/web/pgadmin/tools/datagrid/static/js/datagrid.js b/web/pgadmin/tools/datagrid/static/js/datagrid.js
index 6de7389f..851d53ff 100644
--- a/web/pgadmin/tools/datagrid/static/js/datagrid.js
+++ b/web/pgadmin/tools/datagrid/static/js/datagrid.js
@@ -438,8 +438,8 @@ define('pgadmin.datagrid', [
err.errormsg
);
} catch (e) {
- alertify.alert(
- e.statusText, gettext('Query Tool Initialize Error')
+ alertify.alert(gettext('Query Tool Initialize Error'),
+ e.statusText
);
}
});
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: [pgAdmin4][patch] pgAdmin4 better exception handling
@ 2019-01-23 07:37 Akshay Joshi <[email protected]>
parent: Aditya Toshniwal <[email protected]>
0 siblings, 0 replies; 2+ messages in thread
From: Akshay Joshi @ 2019-01-23 07:37 UTC (permalink / raw)
To: Aditya Toshniwal <[email protected]>; +Cc: pgadmin-hackers
Thanks patch applied.
On Wed, Jan 23, 2019 at 11:01 AM Aditya Toshniwal <
[email protected]> wrote:
> Hi Hackers,
>
> Attached patch will improve exception handling for pgAdmin4 on the server
> side. The app level exception handler will handle unhandled exception
> gracefully, logging it and sending the exception message as response.
> This will also help in getting the exception where users are facing query
> tool initialise error.
>
> Kindly review.
>
> --
> Thanks and Regards,
> Aditya Toshniwal
> Software Engineer | EnterpriseDB Software Solutions | Pune
> "Don't Complain about Heat, Plant a tree"
>
--
*Akshay Joshi*
*Sr. Software Architect *
*Phone: +91 20-3058-9517Mobile: +91 976-788-8246*
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2019-01-23 07:37 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-01-23 05:31 [pgAdmin4][patch] pgAdmin4 better exception handling Aditya Toshniwal <[email protected]>
2019-01-23 07:37 ` Akshay Joshi <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox