CodeSampleX

Sample

makeerror 1.0.12: makeerror

Verified sample for npm makeerror 1.0.12: makeerror. The contract ran on node 22 · linux alpine/x64 · docker and passed: makeError creates custom error…

sha256:8ace1f03e5108f7ede9c558647fa8b1d22275201ba521e7e78dc49fe150f1c9b

This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured. How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people. MIT-0

Execution evidence

The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.

Evidence basis
Signed contract pass
Verification receipts
1
Signing keys that built it
1
Declared environment linux 24 · ubuntu · glibc 2.39 x64 npm

Verification-run environments

Environment Contract Stages Run
node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · node-typescript@1node:22-alpine@sha256:c610fcdfb1d5…
2026-08-27

Case

HOW
Goal
verify makeerror in pkg:npm/makeerror@1.0.12
Packages
Symbols
  • makeerror
Created
2026-08-27T18:49:46Z

Contract

  1. makeError creates custom error constructor with specified name and default message
  2. makeError constructor instantiates error instances with or without new keyword
  3. makeError interpolates placeholders in default message from data object
  4. makeError allows overriding error message at construction time with data interpolation
  5. makeError supports custom error inheritance hierarchy via proto option
  6. makeError rejects invalid proto that is not derived from makeError BaseError

Files

  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • test/contract.mjs

Download the source artifact (tar.gz)

Source

PROMPT.md
Clean-room public code sample — generation instructions

Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.

A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.

Goal: verify makeerror in pkg:npm/makeerror@1.0.12
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/makeerror@1.0.12
Demonstrate these symbols/APIs:
  - makeerror

Rules:
  - One focused purpose; the smallest project that proves the goal.
  - Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
  - Pin every dependency with a lockfile so resolution is reproducible.
  - No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
  - No personal names, emails, company names, or project identifiers of any kind.
  - No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
  - Keep it under 200 files and 256KB packed.
csx.json
{"case":{"caseId":"case:sha256:55f12af7b0744f8550ff1d13b915bb4d0a4ffe83599aaf6996842a9f09d3954b","contract":["makeError creates custom error constructor with specified name and default message","makeError constructor instantiates error instances with or without new keyword","makeError interpolates placeholders in default message from data object","makeError allows overriding error message at construction time with data interpolation","makeError supports custom error inheritance hierarchy via proto option","makeError rejects invalid proto that is not derived from makeError BaseError"],"goal":"verify makeerror in pkg:npm/makeerror@1.0.12","kind":"HOW","packages":["pkg:npm/makeerror@1.0.12"],"schemaVersion":1,"symbols":["makeerror"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"npm","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/makeerror@1.0.12"],"schemaVersion":1,"subject":"pkg:npm/makeerror@1.0.12","symbols":["makeerror"],"verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "sample-makeerror-verification",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-makeerror-verification",
      "version": "1.0.0",
      "license": "MIT-0",
      "dependencies": {
        "makeerror": "1.0.12"
      }
    },
    "node_modules/makeerror": {
      "version": "1.0.12",
      "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz",
      "integrity": "sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg==",
      "license": "BSD-3-Clause",
      "dependencies": {
        "tmpl": "1.0.5"
      }
    },
    "node_modules/tmpl": {
      "version": "1.0.5",
      "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz",
      "integrity": "sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==",
      "license": "BSD-3-Clause"
    }
  }
}
package.json
{
  "name": "sample-makeerror-verification",
  "version": "1.0.0",
  "description": "Clean-room verification for makeerror",
  "license": "MIT-0",
  "dependencies": {
    "makeerror": "1.0.12"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify makeerror in pkg:npm/makeerror@1.0.12",
  "kind": "HOW",
  "packages": [
    "pkg:npm/makeerror@1.0.12"
  ],
  "symbols": [
    "makeerror"
  ]
}
test/contract.mjs
import assert from 'node:assert';
import makeError from 'makeerror';

// 1. makeError creates custom error constructor with specified name and default message
const CustomError = makeError('CustomError', 'default error message');
const err1 = CustomError();
assert.ok(err1 instanceof Error);
assert.ok(err1 instanceof CustomError);
assert.strictEqual(err1.name, 'CustomError');
assert.strictEqual(err1.message, 'default error message');

// 2. makeError constructor instantiates error instances with or without new keyword
const errWithoutNew = CustomError('message without new');
const errWithNew = new CustomError('message with new');
assert.ok(errWithoutNew instanceof CustomError);
assert.ok(errWithNew instanceof CustomError);
assert.strictEqual(errWithoutNew.message, 'message without new');
assert.strictEqual(errWithNew.message, 'message with new');

// 3. makeError interpolates placeholders in default message from data object
const TemplateError = makeError('TemplateError', 'User {id} failed on {action}');
const templatedErr = TemplateError({ id: '42', action: 'checkout' });
assert.strictEqual(templatedErr.message, 'User 42 failed on checkout');
assert.strictEqual(templatedErr.data.id, '42');
assert.strictEqual(templatedErr.data.action, 'checkout');

// 4. makeError allows overriding error message at construction time with data interpolation
const OverriddenError = makeError('OverriddenError', 'default');
const customMsgErr = OverriddenError('Resource {item} status: {code}', { item: 'cart', code: 'timeout' });
assert.strictEqual(customMsgErr.message, 'Resource cart status: timeout');
assert.strictEqual(customMsgErr.data.item, 'cart');
assert.strictEqual(customMsgErr.data.code, 'timeout');

// 5. makeError supports custom error inheritance hierarchy via proto option
const ParentError = makeError('ParentError', 'parent failure');
const ChildError = makeError('ChildError', 'child failure', { proto: new ParentError() });
const childErr = ChildError('child instance');
assert.ok(childErr instanceof ChildError);
assert.ok(childErr instanceof ParentError);
assert.ok(childErr instanceof Error);
assert.strictEqual(childErr.name, 'ChildError');
assert.strictEqual(childErr.message, 'child instance');

// 6. makeError rejects invalid proto that is not derived from makeError BaseError
assert.throws(
  () => makeError('InvalidError', 'msg', { proto: new Error('raw error') }),
  /The custom "proto" must be an Error created via makeError/
);

console.log('Contract passed');

Origin Seeder

anonymous