Start working on /account/data controller
This commit is contained in:
parent
33b2bc2d30
commit
8b1b501bbd
9 changed files with 186 additions and 6 deletions
|
|
@ -1,3 +1,5 @@
|
|||
import { InvalidRequestError } from '../errors';
|
||||
|
||||
const LOGGER = require('@calzoneman/jsli')('AccountDB');
|
||||
|
||||
class AccountDB {
|
||||
|
|
@ -26,7 +28,9 @@ class AccountDB {
|
|||
.where({ name });
|
||||
|
||||
if (rowsUpdated === 0) {
|
||||
throw new Error(`Cannot update: name "${name}" does not exist`);
|
||||
throw new InvalidRequestError(
|
||||
`Cannot update: name "${name}" does not exist`
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import Promise from 'bluebird';
|
||||
import { InvalidRequestError } from '../errors';
|
||||
|
||||
const unlinkAsync = Promise.promisify(fs.unlink);
|
||||
|
||||
|
|
@ -41,7 +42,9 @@ class ChannelDB {
|
|||
.first();
|
||||
|
||||
if (existing) {
|
||||
throw new Error(`Channel "${name}" is already registered.`);
|
||||
throw new InvalidRequestError(
|
||||
`Channel "${name}" is already registered.`
|
||||
);
|
||||
}
|
||||
|
||||
await tx.table('channels')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue