// Fictional TrailNotes example: reproduces a real JavaScript TypeError.
// No network, credentials, personal data, or production application involved.
function formatTitle(note) {
  return note.title.trim();
}

console.log('fixture=TrailNotes-demo-1; input={"title":null}');
console.log(`runtime=${process.version}; platform=${process.platform}`);
try {
  formatTitle({ title: null });
} catch (error) {
  // Keep the actual exception and relevant frame; remove machine-specific paths.
  const frame = error.stack.split('\n').find(line => line.includes('at formatTitle'));
  console.log(`${error.name}: ${error.message}`);
  console.log(frame.replace(/file:\/\/.*\/reproduce-crash\.mjs/, 'reproduce-crash.mjs'));
  process.exitCode = 1;
}
