Code Explainers

Code explainers tagged #fallback

ruby
require "timeout"
require "net/http"
 
class RemoteInventoryClient

Bounding a slow HTTP call with Timeout in Ruby

timeout error-handling http
Intermediate 6 steps
python
from pathlib import Path
 
import chardet
 

Reading text files of unknown encoding in Python

encoding byte-order-mark fallback
Intermediate 8 steps
java
@Service
public class PaymentGatewayClient {
 
    private static final Logger log = LoggerFactory.getLogger(PaymentGatewayClient.class);

Resilient payment calls in Spring

circuit breaker retry fault tolerance
Intermediate 7 steps
javascript
async function copyToClipboard(text) {
  if (navigator.clipboard && window.isSecureContext) {
    try {
      await navigator.clipboard.writeText(text);

Copying to the clipboard with a fallback

clipboard progressive-enhancement dom
Intermediate 8 steps
go
package server
 
import (
	"net/http"

Serving a single-page app with Gin

static-files spa routing
Intermediate 7 steps
java
@Service
public class PaymentGatewayClient {
 
    private static final Logger log = LoggerFactory.getLogger(PaymentGatewayClient.class);

Resilient payment calls with Spring Retry

retry backoff fault-tolerance
Intermediate 7 steps