Code Explainers

Code explainers tagged #error-handling

ruby
module Retryable
  class RetriesExhausted < StandardError; end
 
  RETRYABLE_ERRORS = [

Exponential backoff retries in Ruby

retry-logic exponential-backoff error-handling
Intermediate 7 steps
javascript
async function pollJobUntilComplete(jobId, { interval = 2000, timeout = 60000, signal } = {}) {
  const deadline = Date.now() + timeout;
 
  while (true) {

Polling a job until it finishes in JavaScript

polling async-await abortsignal
Intermediate 6 steps
go
package handlers
 
import (
	"net/http"

Rendering HTML pages with Gin handlers

http-handlers templating error-handling
Beginner 8 steps
rust
use axum::{
    body::Body,
    extract::Path,
    http::{header, StatusCode},

Streaming file downloads in Axum

streaming file-serving path-traversal
Intermediate 8 steps
go
package calc
 
import "testing"
 

Table-driven tests in Go

table-driven-tests error-handling subtests
Intermediate 7 steps
typescript
interface RetryOptions {
  retries?: number;
  baseDelayMs?: number;
  maxDelayMs?: number;

Retrying async tasks with exponential backoff

retry exponential-backoff async
Intermediate 8 steps