Better error handling

This commit is contained in:
syuilo 2019-04-14 04:17:24 +09:00
parent b390363b25
commit e3b3f8fac1
No known key found for this signature in database
GPG key ID: BDC4C49D06AB9D69
25 changed files with 52 additions and 52 deletions

View file

@ -78,7 +78,7 @@ export async function removePinned(user: User, noteId: Note['id']) {
export async function deliverPinnedChange(userId: User['id'], noteId: Note['id'], isAddition: boolean) {
const user = await Users.findOne(userId);
if (user == null) throw 'user not found';
if (user == null) throw new Error('user not found');
if (!Users.isLocalUser(user)) return;

View file

@ -7,7 +7,7 @@ import { renderPerson } from '../../remote/activitypub/renderer/person';
export async function publishToFollowers(userId: User['id']) {
const user = await Users.findOne(userId);
if (user == null) throw 'user not found';
if (user == null) throw new Error('user not found');
const followers = await Followings.find({
followeeId: user.id