exceptions

This commit is contained in:
Andrea Bianchi
2026-05-05 19:50:18 +09:00
parent bd2b95ea1e
commit e51e774ef8
16 changed files with 1613 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
{
"name": "Andrea",
"job": "Professor"
}

View File

@@ -0,0 +1,11 @@
// read the file and print the content
const fs = require('fs');
const path = require('path');
const data = fs.readFileSync(path.join(__dirname, 'data.json'), 'utf8');
console.log(data);
// Fix this
// Read a file that does not exist. This will throw an error.
const wrong = fs.readFileSync(path.join(__dirname, 'wrong.json'), 'utf8');
console.log(wrong);

View File

@@ -0,0 +1,9 @@
{
"name": "exceptions1",
"version": "1.0.0",
"main": "index.js",
"keywords": [],
"author": "",
"license": "ISC",
"description": ""
}