[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Proposal to differentiate between program and processing(precondition) errors

Currently, all errors generated by LedgerSMB are being raised through 'die'. It's an effective way, but my feeling is that it bleeds through too many details of the internals. This is especially true when the error is really nothing more than a reported "missing configuration".

E.g. we currently generate an error in case there's a field's value missing. The generated error includes a stack dump and all!

My proposal is that in this type of error case, we're checking the existence of the required fields and their values. If these don't exist, we should be reporting a nicely formatted error to the client -- most definitely without a stack trace.

Also, the HTTP status code for each error-with-stacktrace is currently "500" -- Internal Server Error. When we *understand* the request, but can't process it, we should be generating a 422 (Unprocessable entity) response or alike.

Now for the question: what would be the best way to achieve this? (I think this applies equally to HTML page responses as it does to web service api calls, so this is a general question that needs a general solution which is applicable for a long time.)



http://efficito.com -- Hosted accounting and ERP.
Robust and Flexible. No vendor lock-in.
Ledger-smb-devel mailing list