Thread: [pgAdmin4][RM#3238] Proper error handling when connection will belost to server.

Hi Hackers,

PFA patch for proper error handling when connection will be lost to server. I have created a common function alertify.pgRespErrorNotify in web/pgadmin/static/js/alertify.pgadmin.defaults.js on the lines of existing function alertify.pgNotifier. The function is called in error callback of $.ajax call. The XHR is passed and handled in the function itself. Please note that I have used JSON.parse and not $.parseJSON as it will be deprecated in jQuery 3.x and thus removing many $.parseJSON calls.

Request you to kindly review.


Thanks and Regards,
Aditya Toshniwal
Software Engineer | EnterpriseDB Software Solutions | Pune
"Don't Complain about Heat, Plant a tree"
Attachment
Hi

On Thu, May 3, 2018 at 11:23 AM, Aditya Toshniwal <aditya.toshniwal@enterprisedb.com> wrote:
Hi Hackers,

PFA patch for proper error handling when connection will be lost to server. I have created a common function alertify.pgRespErrorNotify in web/pgadmin/static/js/alertify.pgadmin.defaults.js on the lines of existing function alertify.pgNotifier. The function is called in error callback of $.ajax call. The XHR is passed and handled in the function itself. Please note that I have used JSON.parse and not $.parseJSON as it will be deprecated in jQuery 3.x and thus removing many $.parseJSON calls.

Request you to kindly review.

Can you add some appropriate tests for the new function please? 

--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
In addition, please address the following linting issues:

Python:
Screen Shot 2018-05-03 at 8.18.29 AM.png

Javascript:
Screen Shot 2018-05-03 at 8.22.11 AM.png


On Thu, May 3, 2018 at 6:38 AM Dave Page <dpage@pgadmin.org> wrote:
Hi

On Thu, May 3, 2018 at 11:23 AM, Aditya Toshniwal <aditya.toshniwal@enterprisedb.com> wrote:
Hi Hackers,

PFA patch for proper error handling when connection will be lost to server. I have created a common function alertify.pgRespErrorNotify in web/pgadmin/static/js/alertify.pgadmin.defaults.js on the lines of existing function alertify.pgNotifier. The function is called in error callback of $.ajax call. The XHR is passed and handled in the function itself. Please note that I have used JSON.parse and not $.parseJSON as it will be deprecated in jQuery 3.x and thus removing many $.parseJSON calls.

Request you to kindly review.

Can you add some appropriate tests for the new function please? 

--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Attachment
Hi Hackers,

PFA updated patch which includes correction of linting issues and test cases for the newly added function alertify.pgRespErrorNotify.
Test cases are added to web/regression/javascript/alerts/alertify_wrapper_spec.js.

Kindly review.

Thanks and Regards,
Aditya Toshniwal
Software Engineer | EnterpriseDB Software Solutions | Pune
"Don't Complain about Heat, Plant a tree"

On Thu, May 3, 2018 at 5:53 PM, Anthony Emengo <aemengo@pivotal.io> wrote:
In addition, please address the following linting issues:

Python:
Screen Shot 2018-05-03 at 8.18.29 AM.png

Javascript:
Screen Shot 2018-05-03 at 8.22.11 AM.png


On Thu, May 3, 2018 at 6:38 AM Dave Page <dpage@pgadmin.org> wrote:
Hi

On Thu, May 3, 2018 at 11:23 AM, Aditya Toshniwal <aditya.toshniwal@enterprisedb.com> wrote:
Hi Hackers,

PFA patch for proper error handling when connection will be lost to server. I have created a common function alertify.pgRespErrorNotify in web/pgadmin/static/js/alertify.pgadmin.defaults.js on the lines of existing function alertify.pgNotifier. The function is called in error callback of $.ajax call. The XHR is passed and handled in the function itself. Please note that I have used JSON.parse and not $.parseJSON as it will be deprecated in jQuery 3.x and thus removing many $.parseJSON calls.

Request you to kindly review.

Can you add some appropriate tests for the new function please? 

--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Attachment
Thanks, patch applied.

Apologies; I forgot to set the author field when I committed. Unfortunately now it's pushed I cannot fix that.

On Fri, May 4, 2018 at 10:33 AM, Aditya Toshniwal <aditya.toshniwal@enterprisedb.com> wrote:
Hi Hackers,

PFA updated patch which includes correction of linting issues and test cases for the newly added function alertify.pgRespErrorNotify.
Test cases are added to web/regression/javascript/alerts/alertify_wrapper_spec.js.

Kindly review.

Thanks and Regards,
Aditya Toshniwal
Software Engineer | EnterpriseDB Software Solutions | Pune
"Don't Complain about Heat, Plant a tree"

On Thu, May 3, 2018 at 5:53 PM, Anthony Emengo <aemengo@pivotal.io> wrote:
In addition, please address the following linting issues:

Python:
Screen Shot 2018-05-03 at 8.18.29 AM.png

Javascript:
Screen Shot 2018-05-03 at 8.22.11 AM.png


On Thu, May 3, 2018 at 6:38 AM Dave Page <dpage@pgadmin.org> wrote:
Hi

On Thu, May 3, 2018 at 11:23 AM, Aditya Toshniwal <aditya.toshniwal@enterprisedb.com> wrote:
Hi Hackers,

PFA patch for proper error handling when connection will be lost to server. I have created a common function alertify.pgRespErrorNotify in web/pgadmin/static/js/alertify.pgadmin.defaults.js on the lines of existing function alertify.pgNotifier. The function is called in error callback of $.ajax call. The XHR is passed and handled in the function itself. Please note that I have used JSON.parse and not $.parseJSON as it will be deprecated in jQuery 3.x and thus removing many $.parseJSON calls.

Request you to kindly review.

Can you add some appropriate tests for the new function please? 

--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company




--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Attachment