Tagged articles
exception-handling
36 articles · Page 1 of 1
This article explains how to refactor Spring MVC controllers by introducing a unified response wrapper, handling String conversion issues with ResponseBodyAdvice, configuring message converters, applying JSR‑303 validation, creating custom validators and exceptions, and centralizing error handling for cleaner, more maintainable backend code.
exception-handlingresponse-body-advicespring-boot
0 likes · 17 min read

This article explains how positioning a try‑catch block either outside or inside a Java for‑loop influences exception handling, loop termination, performance, and memory consumption, providing code examples, execution results, and practical recommendations for backend developers.
Javaexception-handlingfor loop
0 likes · 6 min read

This article explains how to use Python's try‑except and with statements to safely read and process CSV and JSON files, covering common errors such as missing files, permission issues, format problems, and providing best‑practice examples for robust error handling.
CSVJSONexception-handling
0 likes · 7 min read

This article explains why exceptions submitted to a Java thread pool via submit are silent, how to retrieve them using Future.get(), compares submit and execute behaviors, and presents three practical solutions—including try‑catch, Thread.setDefaultUncaughtExceptionHandler, and overriding afterExecute—to reliably capture and process thread pool errors.
FutureafterExecuteexception-handling
0 likes · 14 min read

This article explains PHP's throw keyword, covering exception fundamentals, the try‑catch mechanism, the exception class hierarchy, and provides detailed code examples demonstrating how to throw and handle both built‑in and custom exceptions for robust error management.
BackendThrowcode-example
0 likes · 5 min read

This article explains why proper exception handling is essential for building robust PHP applications, covering the advantages of exceptions over error codes, how to throw, catch, and create custom exceptions, set up global handlers, convert errors to exceptions, and log them effectively.
Backendcustom-exceptionerror-management
0 likes · 7 min read

This article explains how PHP developers can improve code stability and maintainability by using try‑catch blocks, creating custom exception classes, employing multiple catch clauses, adding finally blocks, and leveraging additional functions like throw and set_exception_handler, providing clear examples for each technique.
custom-exceptionerror handlingexception-handling
0 likes · 5 min read

This article explains how to use Spring's HandlerInterceptor to implement common cross‑cutting concerns such as user login validation, unified exception handling, and standardized JSON response formats, comparing it with Spring AOP and providing step‑by‑step code examples and configuration details.
InterceptorMVCexception-handling
0 likes · 18 min read

The article explains Python's exception handling implementation, detailing how the virtual machine executes try/except/else/finally blocks, the bytecode instructions generated for each clause, the static exception table used for fast dispatch, and the effects of return and del statements on control flow and object lifetimes.
PythonTracebackbytecode
0 likes · 19 min read

This article presents a comprehensive guide to Python exception handling, covering basic try‑except usage, multiple exception capture, else/finally clauses, custom exceptions, exception chaining, logging, context managers, assertions, traceback, concurrent and asynchronous error handling, and testing techniques.
ConcurrencyLoggingasyncio
0 likes · 8 min read

This article discusses whether a try‑catch block should be placed inside or outside a Java for‑loop, explains the trade‑offs, and provides code examples illustrating both approaches to help developers write more robust exception‑handling logic.
Backendbest-practicesexception-handling
0 likes · 4 min read

This article explains how Java handles uncaught exceptions in threads, demonstrates setting per‑thread, thread‑group, and global exception handlers, and provides complete code examples illustrating each approach along with their execution results.
exception-handlinguncaught-exception
0 likes · 5 min read

This article explains how Python's raise...from statement can be used to link exceptions, providing clear examples that demonstrate basic usage, function integration, file handling, multi‑level chaining, network errors, class methods, database queries, serialization, loops, and decorators to improve error reporting and debugging.
error handlingexception-handlingprogramming
0 likes · 7 min read

This article explains the fundamental Python concepts of exception handling, modules, and packages, provides their basic syntax, and demonstrates multiple real‑world code examples for handling errors, importing modules, and organizing code with packages.
code-examplesexception-handlingpackages
0 likes · 7 min read

This article presents twenty practical Python exception‑handling techniques, ranging from basic try‑except‑finally blocks to custom exception classes, context‑manager suppression, traceback formatting, and generator cleanup, enabling developers to write more robust, readable, and Pythonic error‑management code.
best-practicescodingerror-management
0 likes · 11 min read

This article introduces Python's interactive debuggers pdb and ipdb, demonstrating how to set breakpoints, step through code, inspect variables, handle exceptions, use conditional breakpoints, and perform remote debugging through concise code examples and command explanations.
PDBRemote Debuggingdebugging
0 likes · 4 min read

The article explains how Java 14 introduces enhanced NullPointerException messages via JEP 358, how to enable them with the -XX:+ShowCodeDetailsInExceptionMessages flag, and discusses the technical details, benefits, and potential security considerations of this feature.
JEP358NullPointerExceptiondebugging
0 likes · 7 min read

The article systematically distinguishes unrecoverable errors from recoverable exceptions and surveys five major handling strategies—global error codes, return‑value conventions, parameter‑based collectors, language‑level exception mechanisms, and OS‑level support—concluding that the optimal approach depends on performance constraints, code‑base design, and portability requirements.
CoroutinesProgramming Paradigmsbackend-development
0 likes · 47 min read

This article explains why Java 8 Lambda‑Streams abort on exceptions, demonstrates the problem with sample code, and shows how to gracefully handle both checked and unchecked exceptions using Vavr's Try wrapper so that stream processing can continue.
Vavrexception-handlingfunctional programming
0 likes · 5 min read

This article provides a comprehensive guide to using Spring Retry and Guava Retry in Java applications, covering dependency setup, basic and annotation-based usage, various retry and back‑off policies, code examples, and a comparison of both frameworks to help developers implement robust retry mechanisms.
Retrybackoff-policyexception-handling
0 likes · 15 min read

This article explains why the Controller layer is essential, identifies common pitfalls such as tangled validation and inconsistent responses, and demonstrates how to refactor Spring MVC controllers using a unified Result wrapper, ResponseBodyAdvice, proper String handling, JSR‑303 validation, custom validators, and global exception handling to produce clean, maintainable backend code.
BackendControllerResponseBodyAdvice
0 likes · 21 min read

This article presents a collection of common Python interview questions covering memory management mechanisms, lambda functions, tuple/list conversion, duplicate removal techniques, sorting tricks, object copying methods, exception handling, the pass statement, range usage, regex operations, match vs search differences, and random number generation, each accompanied by clear explanations and code examples.
Listexception-handlingmemory-management
0 likes · 10 min read

This article explains how Java 8's functional interfaces such as Function, Supplier, Consumer, and Runnable can be used to eliminate repetitive if…else statements, providing concrete interface definitions and utility methods with full code examples for exception handling, branch processing, and present‑or‑else logic.
Javaexception-handlingfunctional-interface
0 likes · 6 min read

This article introduces the Tenacity Python library, explains how to install it, and demonstrates various retry strategies such as unlimited retries, stopping after success, limiting attempts or time, combining stop conditions, setting fixed or random wait intervals, and adding pre‑ and post‑retry logging with complete code examples.
LoggingRetrybackoff
0 likes · 5 min read

The article explains that when a Java finally block throws a new exception or contains a return statement, the original exception from the try block is discarded, demonstrates this with code examples, shows the resulting output, and advises best‑practice handling to avoid losing exception information.
best-practicesexception-handlingfinally
0 likes · 3 min read

This article explains why Spring's @Transactional annotation can silently fail in many typical situations—such as incorrect method visibility, final methods, self‑invocation, unmanaged beans, multithreading, non‑transactional tables, missing configuration, wrong propagation or rollback settings, nested transaction behavior, and oversized transaction scopes—and provides practical solutions to ensure reliable transaction management.
AOPSpringTransaction Management
0 likes · 16 min read

This article explains how Spring MVC processes HTTP 400 errors, walks through the DispatchServlet and exception‑handling flow, shows key code snippets, and provides practical ways to implement global or custom exception resolvers to handle common 400‑causing exceptions.
400-errorBackendexception-handling
0 likes · 7 min read

This article presents nine essential Java exception handling best practices, including using finally blocks or try‑with‑resources for resource cleanup, specifying precise exception types, documenting throws clauses, providing descriptive messages, catching specific exceptions first, avoiding catching Throwable, not ignoring exceptions, and correctly wrapping exceptions without losing the original cause.
Loggingbest-practicesexception-handling
0 likes · 10 min read

This article explains the Java try‑finally mechanism, demonstrates with code why a method returns the original string "Cang Laoshi" rather than the updated value "Xiao Ze", and outlines when finally blocks are guaranteed to run or can be bypassed.
Interviewexception-handlingprogramming
0 likes · 7 min read

This article explains the distinct purposes, usage rules, and underlying bytecode behavior of Java's final, finally, and finalize keywords, covering class and method immutability, variable constancy, guaranteed execution blocks, deprecated finalization, and common performance misconceptions.
FinalFinalizeexception-handling
0 likes · 14 min read

This article explains why retry mechanisms are essential for unstable network requests, introduces the Tenacity library, and provides clear, step‑by‑step Python examples covering basic retries, stop conditions, conditional retries, exception re‑raising, and callback handling.
BackendCode ExampleRetry
0 likes · 7 min read

This article provides a comprehensive guide to Java exception handling, covering the exception hierarchy, key keywords, common pitfalls, interview questions, and a set of best‑practice recommendations to write robust, maintainable Java code.
Interview questionsJavabest-practices
0 likes · 35 min read

This article explains three frequent Python pitfalls—using mutable objects as default arguments, unintentionally sharing class variables, and writing incorrect exception clauses—illustrates the problematic behavior with code examples, and provides the proper patterns to avoid each issue.
Class VariablesPythondefault-arguments
0 likes · 5 min read

The article explains Dubbo's exception‑filter mechanism, demonstrates with a HelloException example why a custom RuntimeException is wrapped into a generic RuntimeException on the consumer side, analyzes the source code logic that decides when to re‑throw or wrap exceptions, and offers practical ways to avoid this pitfall in real projects.
BackendRPCSerialization
0 likes · 9 min read

This article explains the differences between throw and throws, the roles of final, finally, and finalize, when catch can be omitted, how finally executes even after a return in catch, and lists common Java exception classes with illustrative code examples.
BackendThrowexception-handling
0 likes · 7 min read

The article explains how Python's urllib2 raises URLError and HTTPError, details their causes and attributes, and presents two practical approaches for catching and processing these HTTP exceptions to build more robust networked applications.
exception-handlinghttp-errorurllib
0 likes · 6 min read
