mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 02:48:24 +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
|
@ -88,7 +88,7 @@ import {
|
|||
import { SymbolDispose, SymbolMetadata } from "ext:deno_web/00_infra.js";
|
||||
// deno-lint-ignore prefer-primordials
|
||||
if (Symbol.metadata) {
|
||||
throw "V8 supports Symbol.metadata now, no need to shim it!";
|
||||
throw "V8 supports Symbol.metadata now, no need to shim it";
|
||||
}
|
||||
ObjectDefineProperties(Symbol, {
|
||||
dispose: {
|
||||
|
@ -230,7 +230,7 @@ let loadedMainWorkerScript = false;
|
|||
|
||||
function importScripts(...urls) {
|
||||
if (op_worker_get_type() === "module") {
|
||||
throw new TypeError("Can't import scripts in a module worker.");
|
||||
throw new TypeError("Cannot import scripts in a module worker");
|
||||
}
|
||||
|
||||
const baseUrl = location.getLocationHref();
|
||||
|
@ -239,7 +239,7 @@ function importScripts(...urls) {
|
|||
return new url.URL(scriptUrl, baseUrl ?? undefined).href;
|
||||
} catch {
|
||||
throw new DOMException(
|
||||
"Failed to parse URL.",
|
||||
`Failed to parse URL: ${scriptUrl}`,
|
||||
"SyntaxError",
|
||||
);
|
||||
}
|
||||
|
@ -722,7 +722,7 @@ function bootstrapMainRuntime(runtimeOptions, warmup = false) {
|
|||
return jupyterNs;
|
||||
}
|
||||
throw new Error(
|
||||
"Deno.jupyter is only available in `deno jupyter` subcommand.",
|
||||
"Deno.jupyter is only available in `deno jupyter` subcommand",
|
||||
);
|
||||
},
|
||||
set(val) {
|
||||
|
@ -751,7 +751,7 @@ function bootstrapMainRuntime(runtimeOptions, warmup = false) {
|
|||
// https://github.com/tc39/proposal-temporal/pull/2914
|
||||
// https://github.com/tc39/proposal-temporal/pull/2925
|
||||
if (typeof globalThis.Temporal.Instant.fromEpochSeconds === "undefined") {
|
||||
throw "V8 removes obsoleted Temporal API now, no need to delete them!";
|
||||
throw "V8 removes obsoleted Temporal API now, no need to delete them";
|
||||
}
|
||||
delete globalThis.Temporal.Instant.fromEpochSeconds;
|
||||
delete globalThis.Temporal.Instant.fromEpochMicroseconds;
|
||||
|
@ -960,7 +960,7 @@ function bootstrapWorkerRuntime(
|
|||
// https://github.com/tc39/proposal-temporal/pull/2914
|
||||
// https://github.com/tc39/proposal-temporal/pull/2925
|
||||
if (typeof globalThis.Temporal.Instant.fromEpochSeconds === "undefined") {
|
||||
throw "V8 removes obsoleted Temporal API now, no need to delete them!";
|
||||
throw "V8 removes obsoleted Temporal API now, no need to delete them";
|
||||
}
|
||||
delete globalThis.Temporal.Instant.fromEpochSeconds;
|
||||
delete globalThis.Temporal.Instant.fromEpochMicroseconds;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue