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: Catch or Else

    CodeSOD: Catch or Else

    August 5, 2024

    Today’s anonymous submitter asks a question: “How do you imagine the rest of the codebase to be like?”

    Well, let’s look at this snippet of TypeScript and think about it:

    .catch((): void => {
    this.loadFromServerAndShowMessage();
    });
    } else {
    this.loadFromServerAndShowMessage();
    }
    })
    .catch((): void => {
    this.loadFromServerAndShowMessage();
    });
    } else {
    this.loadFromServer();
    }
    }

    From the .catchs, I can tell that we’re looking at a series of nested promises, each loading content based on the results of the previous. The requests may fail in two ways- either through an exception (hence the catch calls), or because it doesn’t return useful data in some fashion (the else clauses).

    Regardless of how it fails, we will loadFromServerAndShowMessage, which implies that we’re not expecting to handle failures based on connectivity. That seems like a mistake- if our promise fails for some reason, it’s likely because we don’t have connectivity, so loadFromServer doesn’t seem like a viable operation. Maybe we should look at the exception?

    Nah, we don’t need to do that.

    How do I imagine the rest of the code base? Well, I imagine it as a messy thicket of dependencies and no real modularity, fragile and confusing, and probably riddled with bugs, many of which are difficult or impossible to replicate in a controlled environment, meaning they’ll likely never get fixed.

    [Advertisement]
    BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!

    Source: Read More 

    Facebook Twitter Reddit Email Copy Link
    Previous ArticleLWiAI Podcast #176 – BIG WEEK! SearchGPT, Lamma 3.1 405B, Mistral Large 2
    Next Article Data Warehouse Solutions Insights: Engineering and Analytics

    Related Posts

    Security

    Nmap 7.96 Launches with Lightning-Fast DNS and 612 Scripts

    May 17, 2025
    Common Vulnerabilities and Exposures (CVEs)

    CVE-2025-48187 – RAGFlow Authentication Bypass

    May 17, 2025
    Leave A Reply Cancel Reply

    Continue Reading

    Experiment with Gemini 2.0 Flash native image generation

    Artificial Intelligence

    CVE-2025-4091 – Mozilla Firefox and Thunderbird Memory Corruption Vulnerability

    Common Vulnerabilities and Exposures (CVEs)

    Build a FinOps agent using Amazon Bedrock with multi-agent capability and Amazon Nova as the foundation model

    Machine Learning

    What is ETL Testing Tutorial Guide

    Development

    Highlights

    eBPF Foundation Announces $250,000 in Grant Awards for Five eBPF Academic Research Projects

    August 29, 2024

    The eBPF Foundation, which focuses on advancing the state of the art for eBPF by…

    The Xbox Game Pass account will cost you more Microsoft Rewards points

    February 25, 2025

    CVE-2025-4243 – Code-projects Online Bus Reservation System SQL Injection Vulnerability

    May 3, 2025

    SEED-Bench-2-Plus: An Extensive Benchmark Specifically Designed for Evaluating Multimodal Large Language Models (MLLMs) in Text-Rich Scenarios

    April 29, 2024
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

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