mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-18 05:19:29 +08:00
14 lines
315 B
TypeScript
14 lines
315 B
TypeScript
try {
|
|
const response = await fetch(process.argv[2]);
|
|
const status: number = response.status;
|
|
const body: string = await response.text();
|
|
console.log(status, body);
|
|
} catch (error) {
|
|
const caught = error as Error;
|
|
console.log(
|
|
caught.name,
|
|
caught.message,
|
|
caught instanceof TypeError,
|
|
);
|
|
}
|