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

    Is positive error codes possible?

    Hello, i have read the RPCResponse class docs as well as the "Error Handling" docs. You recommend error codes <-100 if one is to have own error codes.

    We have an existing error code range today that is positive and basically 1-100 which we use in other systems (rest, batch systems, SMS etc). We would optimally like to have a global set of error codes, also for smartGWT, so that we can set DSResponse.status to our error code and handle that in the client code.

    The main problem for us is that you always consider > 0 to be a success, which means that the dynamicforms will break when we send our custom, positive code back. In our specific test i think it breaks because it expects a Record in the DSResponse data field on successful operation.

    It would be great if one somehow could specify that, for example everything !=1 is an error, or manually tell smartgwt that "this is an error", regardless of error code. Is this somehow possible?

    We thought about manually converting back and forth between - and + so that smartgwt would consider our error codes failures, but that doesn't work either, since it then clashes with your rpcresponse error codes. I guess we could do -200 on the status code and then +200 clientside, but its really hacky... :)

    As usual, your thoughts on what you think would be our best bet are much appreciated.

    Positive error codes aren't possible, and an enhancement to make this possible is not something we'd consider as a Feature Sponsorship, sorry. Just transforming error code from ours to yours when errors are displayed is what we'd recommend. That's very common when two systems are integrated.


      Hey there, huge thanks for quick response! Yes, that is how we did it. Every time we send our error code, we basically do -250, and then when we check it client-side we do +250... :)