git.iko.soy/rowtype-yoga/purescript-yoga-om-layer
on v1.1.1 help sign in
57 lines 1.6 kB history raw
1#!/usr/bin/env bash
3# Helper script to quickly try different error examples
5if [ -z "$1" ]; then
6 echo "Usage: ./try-error.sh <example-number>"
7 echo ""
8 echo "Available examples:"
9 echo " 1 - Missing config entirely"
10 echo " 2 - Partial context (have logger, missing database)"
11 echo " 3 - Multiple missing dependencies"
12 echo " 4 - Success case (all dependencies provided)"
13 echo ""
14 echo "Example: ./try-error.sh 1"
15 exit 1
16fi
18PLAYGROUND="test/Playground.purs"
20# Comment out all examples first
21sed -i.bak 's/^example/-- example/g' "$PLAYGROUND"
22sed -i.bak 's/^combined/-- combined/g' "$PLAYGROUND"
24case "$1" in
25 1)
26 echo "๐Ÿ” Trying Example 1: Missing config entirely"
27 sed -i.bak 's/^-- example1/example1/g' "$PLAYGROUND"
28 ;;
29 2)
30 echo "๐Ÿ” Trying Example 2: Partial context"
31 sed -i.bak 's/^-- example2/example2/g' "$PLAYGROUND"
32 ;;
33 3)
34 echo "๐Ÿ” Trying Example 3: Multiple missing dependencies"
35 sed -i.bak 's/^-- combined/combined/g' "$PLAYGROUND"
36 sed -i.bak 's/^-- example3/example3/g' "$PLAYGROUND"
37 ;;
38 4)
39 echo "โœ… Trying Example 4: Success case"
40 sed -i.bak 's/^-- example4/example4/g' "$PLAYGROUND"
41 ;;
42 *)
43 echo "Invalid example number. Use 1, 2, 3, or 4"
44 exit 1
45 ;;
46esac
48echo ""
49cd /Users/mark/Developer/purescript-yoga-om
50npx spago build -p yoga-om-layer 2>&1 | grep -A 30 "Custom error\|Build succeeded" | head -35
52# Restore backup
53mv "$PLAYGROUND.bak" "$PLAYGROUND" 2>/dev/null
55echo ""
56echo "---"
57echo "To try another example, run: ./try-error.sh <number>"