• madcaesar@lemmy.world
    link
    fedilink
    arrow-up
    13
    arrow-down
    2
    ·
    3 days ago

    Here I am preferring 200, with success boolean / message string…

    Iike HTTP errors codes for real fuck up’s, if I see 500 somethings fucked in the app, otherwise a standardised json response body seems way easier

    • fuzzzerd@programming.dev
      link
      fedilink
      English
      arrow-up
      20
      ·
      3 days ago

      What about both? User supplies bad input? HTTP 400 with response body json describing the error in a standard format?

        • dan@upvote.au
          link
          fedilink
          arrow-up
          5
          ·
          3 days ago

          Throwing exceptions is fine since errors are an exceptional circumstance (not expected during normal use of the app), and you probably want errors to follow a different code path so that they can be logged, alerts triggered if needed, etc.