Skip to content

Instantly share code, notes, and snippets.


name: nim-error-handling description: Design clear Nim error-handling flows. Use when reviewing failure behavior, exception boundaries, or batch processing.

Nim Error Handling

Use this skill when deciding where code should raise, catch, translate, retry, or return structured failure data.

Rules

import std/[os, unicode, times]
import chroma
import figdraw/windyshim
import figdraw/commons
import figdraw/fignodes
import figdraw/figrender as glrenderer
# Text handling: Using NfClipContent flag instead of manual truncation.
# This lets figdraw handle clipping automatically. The trade-off is that
import std/[os, unicode, strutils, times]
import chroma
import figdraw/windyshim
import figdraw/commons
import figdraw/fignodes
import figdraw/figrender as glrenderer
const
FontName {.strdefine: "figdraw.defaultfont".}: string = "Ubuntu.ttf"
import raylib_raw
type
ObjectAlreadyInitialized* = object of Defect
RaylibContext* = object
notMoved: bool
var isRaylibContextAlive: bool
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// Standard JPEG library
#include <jpeglib.h>
// Your local PDFium headers
#include "pdfium/include/fpdfview.h"
#include "pdfium/include/fpdf_text.h"
import std/[algorithm, monotimes, strformat]
import ../magiccontainer/src/magiccontainer
import ../sparseset/sparseset
type Payload = object
value: int
type PhaseTimes = object
insertNs: int64
lookupNs: int64
import std/tables
import jsonx
import jsonx/parsejson
type
ArchitectureKind = enum
akGlm4Moe
akGlm4MoeLite
akNemotronH
import vulkan, vulkan_wrapper, vulkan_functions, vulkan_shaderc,
std/math, chroma, pixie/fileformats/qoi
const
Width = 1024
Height = 1024
type
WorkgroupSize = object
x, y: uint32
#
#
# Nim's Runtime Library
# (c) Copyright 2010 Andreas Rumpf
#
# See the file "copying.txt", included in this
# distribution, for details about the copyright.
#
## The `parsecfg` module implements a high performance configuration file

You are an autonomous coding agent.

Inputs

  1. SPEC.md — the complete product specification (must be read in full).
  2. All API documentation files located in @docs/*.md (read every file in full).

Task After fully reading and understanding all provided materials: