mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-01-23 01:24:09 +00:00
Add error handling in seed.ts
Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
980da1fa43
commit
a72b4b1eb1
1 changed files with 9 additions and 0 deletions
|
@ -56,7 +56,16 @@ createConnection({
|
|||
user.ownedNotes = [note];
|
||||
await connection.manager.save([user, note, revision]);
|
||||
const foundUser = await connection.manager.findOne(User);
|
||||
if (!foundUser) {
|
||||
throw new Error('Could not find freshly seeded user. Aborting.');
|
||||
}
|
||||
const foundNote = await connection.manager.findOne(Note);
|
||||
if (!foundNote) {
|
||||
throw new Error('Could not find freshly seeded note. Aborting.');
|
||||
}
|
||||
if (!foundNote.alias) {
|
||||
throw new Error('Could not find alias of freshly seeded note. Aborting.');
|
||||
}
|
||||
const historyEntry = HistoryEntry.create(foundUser, foundNote);
|
||||
await connection.manager.save(historyEntry);
|
||||
console.log(`Created User '${foundUser.userName}'`);
|
||||
|
|
Loading…
Reference in a new issue