CodeSampleX

Exemple

makeerror 1.0.12

Échantillon vérifié pour npm makeerror 1.0.12. Le contrat s'est exécuté sur node 22 · linux alpine/x64 · docker et a réussi : makeError creates custom error…

sha256:a87ae321ea1b7e3d5b608713710d6e952cb3f79a6337213eb1daca7804a2733b

Ce réseau offre une seule chose : un échantillon qui compile. Il l'a exécuté dans un bac à sable et conservé le reçu signé. Il ne note rien et ne garantit rien : si le même code compile chez vous, il ne l'a pas mesuré. Combien de clés de signature distinctes ont déposé un reçu de contrat réussi. Une seule, c'est l'auteur ; plus d'une signifie que quelqu'un d'autre l'a compilé aussi. Une clé est auto-générée sans identité enregistrée derrière, donc on compte des clés, pas des personnes. MIT-0

Preuves d'exécution

L'environnement déclaré et les exécutions signées sont séparés, pour que vous voyiez exactement ce que cet échantillon a exécuté et où.

Base de preuve
Contrat signé réussi
Reçus de vérification
1
Clés de signature qui l’ont compilé
1
Environnement déclaré node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10

Environnements des exécutions de vérification

Environnement Contrat Étapes Exécution
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

Cas

HOW
Objectif
verify pkg:npm/makeerror@1.0.12
Paquets
Environnement
node 22.23.2
Créé
2026-08-27T12:39:16Z

Contrat

  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

Fichiers

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

Télécharger l’artefact source (tar.gz)

Code 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 pkg:npm/makeerror@1.0.12
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/makeerror@1.0.12
Constraints:
  - executionContext: node
Required runtime conditions:
  - ecosystem: npm
  - language: javascript
  - moduleSystem: cjs
  - packageManager: npm@10.9.8
  - runtime: node@22.23.2

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:e10aafb5799db88e29521de1eeaa5c9950ca4799617d80388d699526ec4c3a1d","constraints":{"executionContext":"node"},"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 pkg:npm/makeerror@1.0.12","kind":"HOW","packages":["pkg:npm/makeerror@1.0.12"],"schemaVersion":1},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"cjs","os":"linux","osVersionBucket":"24","packageManager":"npm","packageManagerVersion":"10.9.8","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/makeerror@1.0.12"],"schemaVersion":1,"subject":"pkg:npm/makeerror@1.0.12","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 pkg:npm/makeerror@1.0.12",
  "kind": "HOW",
  "packages": [
    "pkg:npm/makeerror@1.0.12"
  ],
  "constraints": {
    "executionContext": "node"
  },
  "runtimeConditions": {
    "ecosystem": "npm",
    "language": "javascript",
    "moduleSystem": "cjs",
    "packageManager": "npm@10.9.8",
    "runtime": "node@22.23.2"
  }
}
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');

Seeder d'origine

anonyme