An error occured, please reload the page

1,550 views
Skip to first unread message

Annet

unread,
Jul 19, 2015, 6:40:53 AM7/19/15
to web...@googlegroups.com
After upgrading to web2py version 2.10.4 I sometimes get a flash message:
"An error occured, please reload the page"

This also happens when editing the appconfig.ini file, even though
the appconfig.ini file does not contain an error.

Since the message doesn't give me any information as to why the
error occured, and which file contains the error, I don't see the
point of this flash message.

What is the use of this message?


Kind regards,

Annet

Annet

unread,
Sep 5, 2015, 2:35:50 AM9/5/15
to web2py-users, abas...@gmail.com, anne...@googlemail.com
Hi Anthony,

Anyway, this message should probably be optional or configurable -- maybe submit a github issue requesting that.

 The message "An error occured, please reload the page" is a bit confusing, clicking reload the page doesn't
resolve the error.

When I go to http://127.0.0.1:8000/admin/default/errors/app there's an error log related to the message. When I resolve
the error the message no longer appears.

Does this imply that web2py constantly scans my application for errors, and detects them before I run any code.

Do I turn this off in production?


Kind regards,

Annet

Anthony

unread,
Jul 19, 2015, 9:10:56 AM7/19/15
to web...@googlegroups.com, anne...@googlemail.com
That is handled here in web2py.js (the error message itself is set in web2py_ajax.html, though web2py.js does not provide a default value in case web2py_ajax.html is not included in the page).

If you don't want to edit web2py.js, I think you can add this to your layout (or wherever on the parent page):

<script>
$
(function() {
  $
(document).off('ajaxError');
});
</script>

Of course, that will cancel any other previously defined ajaxError handlers as well (e.g., if you are using some third party library that adds this handler). Alternatively, you could add your own handler to hide the flash div.


Anyway, this message should probably be optional or configurable -- maybe submit a github issue requesting that.

Anthony

Anthony

unread,
Jul 19, 2015, 9:18:12 AM7/19/15
to web...@googlegroups.com, abas...@gmail.com, anne...@googlemail.com
Another hack is to do:

<script>
ajax_error_500 = undefined;

</script>

That will cause the code in web2py.js to fail, which will prevent the flash message from appearing.

Anthony

Anthony

unread,
Sep 5, 2015, 8:18:13 AM9/5/15
to web2py-users

When I go to http://127.0.0.1:8000/admin/default/errors/app there's an error log related to the message. When I resolve
the error the message no longer appears.

Does this imply that web2py constantly scans my application for errors, and detects them before I run any code.

The /errors/app page in admin is just a list of the error tickets that have been generated by your app (they can be grouped by exception, which is the default, or listed as individual tickets in reverse chronological order). web2py is not detecting errors before they occur -- these tickets are generated at the time the error actually does occur.

Anthony

mweissen

unread,
Aug 22, 2016, 2:45:12 AM8/22/16
to web2py-users
What I have done:

db.define_tabel("mytable", Field("message"))

"message" is not allowed as name for a field and I get "An error occured, please reload the page"

Now I reload db.py and I want to change "message" to "mymessage". But I cann't: the error message appears faster than I could edit db.py.
Next step: I want to change the layout file ("ajax_error..."). No chance, same problem - the error message is faster!

Yes. I can use an external editor. But what I want to know: how can I change my program using only web2py? Seem that I have to delete my application :-(

Anthony

unread,
Aug 22, 2016, 8:09:01 AM8/22/16
to web2py-users
If you are receiving an error while in the admin app, then the error is within the admin app itself, not your own app code. To see what the error is, visit the errors page for the admin app itself. You can also open the browser developer tools to examine the specific Ajax request and response that is generating the error.

Anthony

Martin Weissenboeck

unread,
Aug 22, 2016, 3:57:41 PM8/22/16
to web2py-users
Hi Anthony!

No, the error is within the app.
Please try it:

(1) Create a new app
(2) Add this line to db.py:

db.define_table("mytable", Field("message"))

(3) Wait some seconds. The message 

"An error occured, please reload the page"
appears.

(4) The error message in the error file is:

Ticket ID

127.0.0.1.2016-08-22.19-27-17.e41bd317-6e9a-4bb8-a12f-3f46b46ed767

<type 'exceptions.SyntaxError'> invalid table/column name "message" is a "ALL" reserved SQL/NOSQL keyword


(5) And now I try to correct the error:

I reload the page. But I cannot edit the page because the message "An error occured, please reload the page" appears again. And I reload the page.... and so on.

An additional notice:
  • I have tried it on the local machine. It seems, that the error message appears late - therefore it was possible to correct the file db.py. 
  • On a remote machine the error message appears very rapid (within 1 second or so)  and I could not correct the file db.py.
Regards. Martin


--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.




Anthony

unread,
Aug 22, 2016, 6:41:19 PM8/22/16
to web2py-users, mwei...@gmail.com
OK, I see. At the bottom of the editor page there is a "Hooks" link which reveals a hidden Ajax component when clicked (it shows any _before/_after database callbacks attached to the DAL table models). That Ajax component actually calls the hooks() action in the appadmin.py controller of the app being edited, which of course results in the models of that app being executed, thus producing this error.

However, the error message you see with instructions to reload the page simply refers to the Ajax error. You can simply dismiss that message and continue editing the file to fix the problem.

This error message appears whenever an Ajax call returns an error. We should probably disable this on the admin editor page and instead display an error message in the "Hooks" component. If you don't mind, could you submit a Github issue and refer to this thread?

Anthony


On Monday, August 22, 2016 at 3:57:41 PM UTC-4, mweissen wrote:
Hi Anthony!

No, the error is within the app.
Please try it:

(1) Create a new app
(2) Add this line to db.py:

db.define_table("mytable", Field("message"))

(3) Wait some seconds. The message 

"An error occured, please reload the page"
appears.

(4) The error message in the error file is:

Ticket ID

127.0.0.1.2016-08-22.19-27-17.e41bd317-6e9a-4bb8-a12f-3f46b46ed767

<type 'exceptions.SyntaxError'> invalid table/column name "message" is a "ALL" reserved SQL/NOSQL keyword


(5) And now I try to correct the error:

I reload the page. But I cannot edit the page because the message "An error occured, please reload the page" appears again. And I reload the page.... and so on.

An additional notice:
  • I have tried it on the local machine. It seems, that the error message appears late - therefore it was possible to correct the file db.py. 
  • On a remote machine the error message appears very rapid (within 1 second or so)  and I could not correct the file db.py.
Regards. Martin

Martin Weissenboeck

unread,
Aug 23, 2016, 1:12:38 AM8/23/16
to Anthony, web2py-users
Anthony,

maybe I did not find the right words to describe the situation:.
  1. While the error message is visible, I can edit the page. 
  2. The "save"-button is not disabled, but it does nothing. No changes are stored.
  3. It is clear, that I have to dismiss the message. 
  4. Again like 1 and 2: I can edit the page, but I cannot store it.
  5. Therefore I have to reload the page - without a reload it is not possible to save the page again, 
  6. And now the error message returns so fast, that it is not possible to edit and store the corrected page. We start again with step 1.
Regards, Martin

Anthony

unread,
Aug 23, 2016, 8:24:37 AM8/23/16
to web2py-users, abas...@gmail.com, mwei...@gmail.com
On Tuesday, August 23, 2016 at 1:12:38 AM UTC-4, mweissen wrote:
Anthony,

maybe I did not find the right words to describe the situation:.
  1. While the error message is visible, I can edit the page. 
  2. The "save"-button is not disabled, but it does nothing. No changes are stored.
  3. It is clear, that I have to dismiss the message. 
  4. Again like 1 and 2: I can edit the page, but I cannot store it.
  5. Therefore I have to reload the page - without a reload it is not possible to save the page again, 
  6. And now the error message returns so fast, that it is not possible to edit and store the corrected page. We start again with step 1.
In that case, I cannot reproduce your problem. I can definitely continue to edit and save changes to the file despite the Ajax error (e.g., I can correct the error so on subsequent page reloads I no longer get the Ajax error message).

What happens when you try to save? Do you see any error message? In the browser developer tools, do you see an Ajax request fired off or any errors in the Javascript console?

Anthony

Anthony

unread,
Aug 23, 2016, 8:25:21 AM8/23/16
to web2py-users
Also, what version of web2py are you using, and on what platform/browser?
Reply all
Reply to author
Forward
0 new messages