Skip to content
Snippets Groups Projects
Unverified Commit bbf4e1c4 authored by syuilo's avatar syuilo
Browse files

Add fallback for broken db

parent a24a20a8
No related branches found
Tags 10.87.2
No related merge requests found
......@@ -4,6 +4,7 @@ import AccessToken from './access-token';
import db from '../db/mongodb';
import isObjectId from '../misc/is-objectid';
import config from '../config';
import { dbLogger } from '../db/logger';
const App = db.get<IApp>('apps');
App.createIndex('secret');
......@@ -66,6 +67,12 @@ export const pack = (
}
}
// (データベースの欠損などで)アプリがデータベース上に見つからなかったとき
if (_app == null) {
dbLogger.warn(`[DAMAGED DB] (missing) pkg: app :: ${app}`);
return null;
}
// Rename _id to id
_app.id = _app._id;
delete _app._id;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment