ESM: Tidied up recently added operations

This commit is contained in:
n1474335 2018-05-28 15:42:43 -07:00
parent 6a561185df
commit 3f3a3e0016
12 changed files with 2082 additions and 2069 deletions

View file

@ -7,6 +7,7 @@
import { fromBase64, toBase64 } from "../lib/Base64";
import { fromHex } from "../lib/Hex";
import Operation from "../Operation";
import OperationError from "../errors/OperationError";
import Utils from "../Utils";
import Magic from "../lib/Magic";
@ -37,9 +38,7 @@ class RenderImage extends Operation {
{
"match": "^(?:\\xff\\xd8\\xff|\\x89\\x50\\x4e\\x47|\\x47\\x49\\x46|.{8}\\x57\\x45\\x42\\x50|\\x42\\x4d)",
"flags": "",
"args": [
"Raw"
],
"args": ["Raw"],
"useful": true
}
];
@ -77,7 +76,7 @@ class RenderImage extends Operation {
if (type && type.mime.indexOf("image") === 0) {
dataURI += type.mime + ";";
} else {
throw "Invalid file type";
throw new OperationError("Invalid file type");
}
// Add image data to URI