Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Best practice: Not transferring Database exceptions to the client

    Hi Isomorphic,

    w.r.t. to this post of yours and the described way to hide stack traces, what is the suggested way of hiding Database errors (e.g. "unique constraint validation, as I did not set a unique validator in .ds.xml") from the end user and from being transferred to the browser in general (using 12.0p)?
    Here I'd just want an error message like "A Database error occured. Please contact your admin." or similar.

    Is there either some setting or some way of configuring this (in RPCManager?)?

    Thank you & Best regards
    Blama

    #2
    Hi Isomorphic,

    do you have an advice on this one?
    Thinking about it, I could most likely do this manually in a central SQLDataSource-subclass method like execute():

    Pseudo code:
    Code:
    DSResponse resp = super(...);
    if (resp.status = -1)
      remove error message and replace by some "DB call failed"-message;
    
    return resp;
    Is this the suggested way?
    I do only want to remove the nasty "ORA-xxxxx" you get sometimes when you are not protecting the DB from all wrong constraint violating data which do not yet have a validator.

    Best regards
    Blama

    Comment


      #3
      In general you don't want to create an app where an end user can never trigger such exceptions.

      If you are worried about transient errors or bugs in your app revealing DB exceptions, then catching them in execute() is a fine approach.

      Comment

      Working...
      X