mirror of
https://github.com/denoland/deno.git
synced 2025-02-07 23:06:50 -05:00
Revert move suggestion to runtime/fmt_errors.rs
This commit is contained in:
parent
4cca9ae370
commit
6453b7fe54
2 changed files with 8 additions and 24 deletions
|
@ -267,14 +267,20 @@ function createImageBitmap(
|
||||||
} else if (mimeTypeString === "") {
|
} else if (mimeTypeString === "") {
|
||||||
return PromiseReject(
|
return PromiseReject(
|
||||||
new DOMException(
|
new DOMException(
|
||||||
`The MIME type of source image is not specified`,
|
`The MIME type of source image is not specified\n
|
||||||
|
hint: When you want to get a "Blob" from "fetch", make sure to go through a file server that returns the appropriate content-type response header,
|
||||||
|
and specify the URL to the file server like "await(await fetch('http://localhost:8000/sample.png').blob()".
|
||||||
|
Alternatively, if you are reading a local file using 'Deno.readFile' etc.,
|
||||||
|
set the appropriate MIME type like "new Blob([await Deno.readFile('sample.png')], { type: 'image/png' })".\n`,
|
||||||
"InvalidStateError",
|
"InvalidStateError",
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return PromiseReject(
|
return PromiseReject(
|
||||||
new DOMException(
|
new DOMException(
|
||||||
`The MIME type ${mimeTypeString} of source image is not a supported format`,
|
`The the MIME type ${mimeTypeString} of source image is not a supported format\n
|
||||||
|
info: The following MIME types are supported.
|
||||||
|
docs: https://mimesniff.spec.whatwg.org/#image-type-pattern-matching-algorithm\n`,
|
||||||
"InvalidStateError",
|
"InvalidStateError",
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
@ -458,28 +458,6 @@ fn get_suggestions_for_terminal_errors(e: &JsError) -> Vec<FixSuggestion> {
|
||||||
]),
|
]),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
// See: ext/canvas/01_image.js
|
|
||||||
else if msg.contains("The MIME type of source image is not specified") {
|
|
||||||
return vec![
|
|
||||||
FixSuggestion::hint_multiline(&[
|
|
||||||
cstr!("When you want to get a <u>Blob</> from <u>fetch</>, make sure to go through a file server that returns the appropriate content-type response header,"),
|
|
||||||
cstr!("and specify the URL to the file server like <u>await(await fetch('http://localhost:8000/sample.png').blob()</>."),
|
|
||||||
cstr!("Alternatively, if you are reading a local file using <u>Deno.readFile</> etc.,"),
|
|
||||||
cstr!("set the appropriate MIME type like <u>new Blob([await Deno.readFile('sample.png')], { type: 'image/png' })</>.")
|
|
||||||
]),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
// See: ext/canvas/01_image.js
|
|
||||||
else if msg.contains("The MIME type")
|
|
||||||
&& msg.contains("of source image is not a supported format")
|
|
||||||
{
|
|
||||||
return vec![
|
|
||||||
FixSuggestion::info(
|
|
||||||
"The following MIME types are supported."
|
|
||||||
),
|
|
||||||
FixSuggestion::docs("https://mimesniff.spec.whatwg.org/#image-type-pattern-matching-algorithm"),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vec![]
|
vec![]
|
||||||
|
|
Loading…
Add table
Reference in a new issue