mirror of
https://github.com/denoland/deno.git
synced 2025-09-26 20:29:11 +00:00
refactor(runtime): align error messages (#25563)
Aligns the error messages in the runtime folder to be in-line with the Deno style guide. https://github.com/denoland/deno/issues/25269
This commit is contained in:
parent
7477c2d706
commit
606b7b17c6
5 changed files with 71 additions and 35 deletions
|
@ -101,7 +101,7 @@ class Process {
|
|||
|
||||
async output() {
|
||||
if (!this.stdout) {
|
||||
throw new TypeError("stdout was not piped");
|
||||
throw new TypeError("Cannot collect output: 'stdout' is not piped");
|
||||
}
|
||||
try {
|
||||
return await readAll(this.stdout);
|
||||
|
@ -112,7 +112,7 @@ class Process {
|
|||
|
||||
async stderrOutput() {
|
||||
if (!this.stderr) {
|
||||
throw new TypeError("stderr was not piped");
|
||||
throw new TypeError("Cannot collect output: 'stderr' is not piped");
|
||||
}
|
||||
try {
|
||||
return await readAll(this.stderr);
|
||||
|
@ -241,7 +241,7 @@ class ChildProcess {
|
|||
#stdin = null;
|
||||
get stdin() {
|
||||
if (this.#stdin == null) {
|
||||
throw new TypeError("stdin is not piped");
|
||||
throw new TypeError("Cannot get 'stdin': 'stdin' is not piped");
|
||||
}
|
||||
return this.#stdin;
|
||||
}
|
||||
|
@ -249,7 +249,7 @@ class ChildProcess {
|
|||
#stdout = null;
|
||||
get stdout() {
|
||||
if (this.#stdout == null) {
|
||||
throw new TypeError("stdout is not piped");
|
||||
throw new TypeError("Cannot get 'stdout': 'stdout' is not piped");
|
||||
}
|
||||
return this.#stdout;
|
||||
}
|
||||
|
@ -257,7 +257,7 @@ class ChildProcess {
|
|||
#stderr = null;
|
||||
get stderr() {
|
||||
if (this.#stderr == null) {
|
||||
throw new TypeError("stderr is not piped");
|
||||
throw new TypeError("Cannot get 'stderr': 'stderr' is not piped");
|
||||
}
|
||||
return this.#stderr;
|
||||
}
|
||||
|
@ -273,7 +273,7 @@ class ChildProcess {
|
|||
extraPipeRids,
|
||||
} = null) {
|
||||
if (key !== illegalConstructorKey) {
|
||||
throw new TypeError("Illegal constructor.");
|
||||
throw new TypeError("Illegal constructor");
|
||||
}
|
||||
|
||||
this.#rid = rid;
|
||||
|
@ -313,12 +313,12 @@ class ChildProcess {
|
|||
async output() {
|
||||
if (this.#stdout?.locked) {
|
||||
throw new TypeError(
|
||||
"Can't collect output because stdout is locked",
|
||||
"Cannot collect output: 'stdout' is locked",
|
||||
);
|
||||
}
|
||||
if (this.#stderr?.locked) {
|
||||
throw new TypeError(
|
||||
"Can't collect output because stderr is locked",
|
||||
"Cannot collect output: 'stderr' is locked",
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -334,13 +334,13 @@ class ChildProcess {
|
|||
signal: status.signal,
|
||||
get stdout() {
|
||||
if (stdout == null) {
|
||||
throw new TypeError("stdout is not piped");
|
||||
throw new TypeError("Cannot get 'stdout': 'stdout' is not piped");
|
||||
}
|
||||
return stdout;
|
||||
},
|
||||
get stderr() {
|
||||
if (stderr == null) {
|
||||
throw new TypeError("stderr is not piped");
|
||||
throw new TypeError("Cannot get 'stderr': 'stderr' is not piped");
|
||||
}
|
||||
return stderr;
|
||||
},
|
||||
|
@ -349,7 +349,7 @@ class ChildProcess {
|
|||
|
||||
kill(signo = "SIGTERM") {
|
||||
if (this.#waitComplete) {
|
||||
throw new TypeError("Child process has already terminated.");
|
||||
throw new TypeError("Child process has already terminated");
|
||||
}
|
||||
op_spawn_kill(this.#rid, signo);
|
||||
}
|
||||
|
@ -428,13 +428,13 @@ function spawnSync(command, {
|
|||
signal: result.status.signal,
|
||||
get stdout() {
|
||||
if (result.stdout == null) {
|
||||
throw new TypeError("stdout is not piped");
|
||||
throw new TypeError("Cannot get 'stdout': 'stdout' is not piped");
|
||||
}
|
||||
return result.stdout;
|
||||
},
|
||||
get stderr() {
|
||||
if (result.stderr == null) {
|
||||
throw new TypeError("stderr is not piped");
|
||||
throw new TypeError("Cannot get 'stderr': 'stderr' is not piped");
|
||||
}
|
||||
return result.stderr;
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue