Close Menu
    DevStackTipsDevStackTips
    • Home
    • News & Updates
      1. Tech & Work
      2. View All

      Sunshine And March Vibes (2025 Wallpapers Edition)

      May 16, 2025

      The Case For Minimal WordPress Setups: A Contrarian View On Theme Frameworks

      May 16, 2025

      How To Fix Largest Contentful Paint Issues With Subpart Analysis

      May 16, 2025

      How To Prevent WordPress SQL Injection Attacks

      May 16, 2025

      Microsoft has closed its “Experience Center” store in Sydney, Australia — as it ramps up a continued digital growth campaign

      May 16, 2025

      Bing Search APIs to be “decommissioned completely” as Microsoft urges developers to use its Azure agentic AI alternative

      May 16, 2025

      Microsoft might kill the Surface Laptop Studio as production is quietly halted

      May 16, 2025

      Minecraft licensing robbed us of this controversial NFL schedule release video

      May 16, 2025
    • Development
      1. Algorithms & Data Structures
      2. Artificial Intelligence
      3. Back-End Development
      4. Databases
      5. Front-End Development
      6. Libraries & Frameworks
      7. Machine Learning
      8. Security
      9. Software Engineering
      10. Tools & IDEs
      11. Web Design
      12. Web Development
      13. Web Security
      14. Programming Languages
        • PHP
        • JavaScript
      Featured

      The power of generators

      May 16, 2025
      Recent

      The power of generators

      May 16, 2025

      Simplify Factory Associations with Laravel’s UseFactory Attribute

      May 16, 2025

      This Week in Laravel: React Native, PhpStorm Junie, and more

      May 16, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      Microsoft has closed its “Experience Center” store in Sydney, Australia — as it ramps up a continued digital growth campaign

      May 16, 2025
      Recent

      Microsoft has closed its “Experience Center” store in Sydney, Australia — as it ramps up a continued digital growth campaign

      May 16, 2025

      Bing Search APIs to be “decommissioned completely” as Microsoft urges developers to use its Azure agentic AI alternative

      May 16, 2025

      Microsoft might kill the Surface Laptop Studio as production is quietly halted

      May 16, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»Development»CodeSOD: Sdrawkcab Error Handling

    CodeSOD: Sdrawkcab Error Handling

    June 24, 2024

    When interacting with RESTful web services, there’s a depressingly common anti-pattern: always return status 200 OK, but embed a more meaningful status code in the body of the response. Frequently, the embedded status code is just the HTTP status code you should have returned in the first place.

    This “fixes” situations where you have badly behaving clients that don’t do proper error handling, but also breaks the entire point of doing REST.

    Alice works on an app that, while most of the time the code is decent, has a service that does this. This service also does something even worse: depending on the URL parameters you pass to the query, it may do something like this when it returns errors:

    {
    “statusCode”: 422,
    “errors”: {
    “Value should be an integer”: [
    “version”
    ]
    }
    }

    Or something like this:

    {
    “statusCode”: 422,
    “errors”: {
    “orderSatus”: [
    “The value you selected is not a valid choice.”
    ]
    }
    }

    Sometimes, the service returns errors in the form “error message: [list of fields]”, and sometimes it returns errors in the form “field: [list of errors]”. I’d argue that the latter is more correct, but either is workable if they were at least consistent.

    At first, looking at the responses, I assumed this was some multi-team, microservice situation where you had specification drift and two different teams solving the same problem slightly differently, but no: it’s just one service, maintained by one small team.

    These kinds of inconsistencies abound in the codebase. The entire thing is designed to make the front-end team pull their hair out, and any third parties consuming the API to go completely insane.

    Alice writes: “I’m glad I only maintain the back-end and front-end is someone else’s job.”

    Alice says that, but she clearly has her work cut out for her, too, if this is going to get any better.

    [Advertisement]
    Utilize BuildMaster to release your software with confidence, at the pace your business demands. Download today!

    Source: Read More 

    Facebook Twitter Reddit Email Copy Link
    Previous ArticleFriction – motion graphics software for vector and raster animations
    Next Article How to load Config.properties file in Cucumber TestRunner.java file?

    Related Posts

    Security

    Nmap 7.96 Launches with Lightning-Fast DNS and 612 Scripts

    May 16, 2025
    Common Vulnerabilities and Exposures (CVEs)

    CVE-2025-47916 – Invision Community Themeeditor Remote Code Execution

    May 16, 2025
    Leave A Reply Cancel Reply

    Continue Reading

    FCC Launches ‘Cyber Trust Mark’ for IoT Devices to Certify Security Compliance

    Development

    Distribution Release: Pardus 23.4

    News & Updates

    Server crashes force Call of Duty devs to disable Ranked Play in Warzone yet again

    News & Updates

    FinTech Software Development

    Development

    Highlights

    News & Updates

    How to preorder the new Surface Pro and Surface Laptop

    May 6, 2025

    Microsoft just announced a Surface Pro 12-inch and Surface Laptop 13-inch. The compact PCs are…

    How to Manage Recurring ACH Payments in QuickBooks

    April 8, 2024

    Top 10 Use Cases of Gen AI in the Real Estate Industry

    August 19, 2024

    Scrolling using the same code is working 7/10 times

    May 13, 2024
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.