Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I don't know that a "correct" way has yet emerged due to the fact that how web services are being utilized is changing so rapidly and, ultimately, any client being constructed to consume the service is capable of handling whatever method you choose. I have no doubt that ultimately one will be devised but for now it's up to you.</p> <p>That being said try to avoid some of the more common pitfalls I've seen in the past.</p> <ol> <li>Lack of Consistency: If your web service has multiple methods devise a way that they all may communicate errors in the same fashion to make your methods easier to consume. Personally I prefer following in the footsteps of protocol stacks and using some sort of consistent header. Build your resulting messages with a common header so that the same logic may be used throughout the client's code to determine if the method call was successful. </li> <li>No Support For Multiple Error Messages: Sometimes multiple failures occurred. Blinding the client to the secondary error can be a nuisance and slow down debugging attempts.</li> <li>Lack of Identification for Error Messages: If the error is the result of a particular field being invalid allow the client to programmatically identify which field is the culprit based on information you provide.</li> </ol> <p>The approach I generally start with these days looks something like this:</p> <pre><code>{ Success: bool, Errors[]: { Id: string, Source: string, Message: string }, Message: { *Method specific structure* } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload