How to display or customize CRUD error messages in Flask Admin - flask-admin

What is the best way to display when there is error in Listing, Create, Delete or Edit? So far I have created model and custom BaseModelView. Everything seem to work in happy path. I tried throwing exception from the various methods that I had to implement my custom BaseModelView. It result in internal server error. This is probably expected, but how do I show custom error messages for these operation. Is there any provision in Flask Admin for showing custom error messages for the CRUD errors?

I tried Flash message. It worked just fine.

Related

How to Get error message from DB and display it in QGIS Plugin?

I am trying to create a Custom QGIS plugin where i connect the Db and execute the queries from a selected file. what I need is to display the usual error message which gets displayed in the DB while any error is raised during the connection and execution.
Please let me know any ways to get the traceback message and display it plugin, I have also referred to the scripts of the DB manager plugin also. but it seems difficult for me to get exactly how they did it.
From this link, try this one:
try:
#your code here
except QgsProviderConnectionException as e:
raise DbError(e)

How can I use postgraphQL in conjunction with ReactQL

I'd like to use the postgraphQL library to auto-generate my graphql schema from a postgres database. I've used this in express apps previously, but I'm trying to make it work with the ReactQL starter kit.
In an express app server file, I've imported postgraphql and then used something like:
app.use(postgraphql(endpoint, schema, {options}));
Seems like the syntax is probably similar with the Koa server in ReactQL, but I'm not quite sure where to put it.
Update: I got it working by adding the code above into the /kit/entry/server.js file in ReactQL. Maybe someone can point out whether or not that's a good practice if it's supposed to occur somewhere else, like in app.js.
Update 2: While the above seems to work (I can hit graphiql and see my schema), I'm getting this message in the terminal:
Error: Can't set headers after they are sent.
and this in the browser console:
PostGraphQL: Listening for server sent events
PostGraphQL: Failed to connect to server

Issues with WebIDE CRUD template and OData errors

Has anyone successfully based an application off the WebIDE Fiori CRUD template? It doesn't seem to be able to handle errors in the batch OData request properly.
For example when you select an item in the master list and click EDIT to update it and I enter a value that I know will cause an error in the backend. The batch OData request is sent and the response is successful (overall) even though internally the update failed. You see a bad request 400 error in the console but the app doesn't react to it.
Using the ErrorHandler.js object you can easily code a message box to show a nice error message, however the app seems to get confused and always navigates to the top item in the list but the ODataModel still has pending changes so if you try to navigate it shows the data loss dialog.
Trying to debug it is very painful given the nature of the code with Promises inside promises inside promises and callbacks firing everywhere!!
Maybe there is a better example CRUD application to base your apps on?
Well.... Some more debugging and I've found that all of the weird issues occurring with the Fiori CRUD template are due to the model defaulting to auto refreshing after changes.
Which typically is a nice feature as the user does not have to hit the refresh button to see changes that have been made after adding a new entry or editing an object.
But this auto refresh on the model seems to play havoc with updates in batch mode.
Firstly, if the batch update is completely successful the app navigates to the first item in the master list - which is should not.
Secondly, when there is an error in the batch of sorts of weird shit happens.
So to fix this I just call oModel.setRefreshAfterChange(false) before the oModel.submitChanges() call (only when updating, not creating). The in the callback after the save is completed we reset auto refresh to true.
The crud app now works as expected and can correctly handle errors in the odata batch update without strange ui updates.
Jason,
but the error message they are providing is very simple, and does not support parsing error body like :
<code>005056A509B11ED199D882461C8C40FE</code><message xml:lang="en">The Data Services Request version '3.0' is not supported for the request payload.</message><
we have to do the code for parsing the errors then show in the message box

Apigee can't add TradeTracker Soap API

I'm very new to Apigee.
I'm adding an existing WSDL service as a API proxy.
When fetching the SOAP functions, all looks good. Every single one is imported and are setup correctly.
When i then hit the save button the proxy is created, but are never submitting the revision to the server.
When looking into the problem I see that i get a 502 error back from a file named https://enterprise.apigee.com/gw/upload/[NAME]/tradetracker-api/?validate=true
Also a TypeError: 'undefined' is not an object (evaluating 'b.then') are thrown from a file named 24efdbdd.proxy-editor.js
As i'm using Apigee's own website to add the proxy, so there's not much i can do about it.
This is happening in both Chrome 32, Safari 7 and Firefox 25 and the error has been there for at least a week.
I can't be the only one using Apigee's which keep's getting this error!?
There appears to be an issue with the WSDL file format -- not entirely sure what it is as one WSDL validator I used said it was okay, and another one choked on it saying it wasn't able to parse the file.
I've opened an issue with the Apigee product team to see if A) we can identify the issue with this WSDL and B) improve the product to throw a proper error rather than timing out.
This is fixed in the next release that is scheduled for release on 2/5/2014.

How to test an error page with Error 500 using Zend Framework

I am working on a project where client requires me to beautifully display error 500 with stacktrace etc.
So, I checked the Error Controller and made a nice fancy error page in corresponding views/script
The problem is, how do I test it?
Whilst working on the project, I cleared error on every page and there is no way I could generate it again. Also, I am using doctrine and I remember "echo-ing" the entitymanager array but, I cannot trace the location.
How would I custom generate error 500, "keeping it real"?
PS: I tried htaccess thing and trust me, it throws apache error and not zend 500.
It was pretty silly but, finally found it.
All I needed was to mis-spell a dql tablename on any page where I use querybuilder.