throw error if failed
This commit is contained in:
parent
355b1e0063
commit
af4797bb8e
@ -6,7 +6,7 @@ import { ApiError } from "../../../error.js";
|
||||
import rndstr from "rndstr";
|
||||
import { publishBroadcastStream } from "@/services/stream.js";
|
||||
import { db } from "@/db/postgre.js";
|
||||
import { type Size, getEmojiSize } from "@/misc/emoji-meta.js";
|
||||
import { getEmojiSize } from "@/misc/emoji-meta.js";
|
||||
|
||||
export const meta = {
|
||||
tags: ["admin"],
|
||||
@ -40,12 +40,7 @@ export default define(meta, paramDef, async (ps, me) => {
|
||||
? file.name.split(".")[0]
|
||||
: `_${rndstr("a-z0-9", 8)}_`;
|
||||
|
||||
let size: Size = { width: 0, height: 0 };
|
||||
try {
|
||||
size = await getEmojiSize(file.url);
|
||||
} catch {
|
||||
/* skip if any error happens */
|
||||
}
|
||||
const size = await getEmojiSize(file.url);
|
||||
|
||||
const emoji = await Emojis.insert({
|
||||
id: genId(),
|
||||
|
@ -6,7 +6,7 @@ import type { DriveFile } from "@/models/entities/drive-file.js";
|
||||
import { uploadFromUrl } from "@/services/drive/upload-from-url.js";
|
||||
import { publishBroadcastStream } from "@/services/stream.js";
|
||||
import { db } from "@/db/postgre.js";
|
||||
import { type Size, getEmojiSize } from "@/misc/emoji-meta.js";
|
||||
import { getEmojiSize } from "@/misc/emoji-meta.js";
|
||||
|
||||
export const meta = {
|
||||
tags: ["admin"],
|
||||
@ -65,12 +65,7 @@ export default define(meta, paramDef, async (ps, me) => {
|
||||
throw new ApiError();
|
||||
}
|
||||
|
||||
let size: Size = { width: 0, height: 0 };
|
||||
try {
|
||||
size = await getEmojiSize(driveFile.url);
|
||||
} catch {
|
||||
/* skip if any error happens */
|
||||
}
|
||||
const size = await getEmojiSize(driveFile.url);
|
||||
|
||||
const copied = await Emojis.insert({
|
||||
id: genId(),
|
||||
|
Loading…
Reference in New Issue
Block a user