mirror of https://github.com/laurent22/joplin.git
Server: Improve log quality by increasing specificity of error (#10287)
parent
681d1d67f3
commit
837826ea4f
|
@ -390,13 +390,13 @@ export default abstract class BaseModel<T> {
|
|||
}
|
||||
|
||||
public async load(id: Uuid | number, options: LoadOptions = {}): Promise<T> {
|
||||
if (!id) throw new Error('id cannot be empty');
|
||||
if (!id) throw new ErrorBadRequest('id cannot be empty');
|
||||
|
||||
return this.db(this.tableName).select(options.fields || this.defaultFields).where({ id: id }).first();
|
||||
}
|
||||
|
||||
public async delete(id: string | string[] | number | number[], options: DeleteOptions = {}): Promise<void> {
|
||||
if (!id) throw new Error('id cannot be empty');
|
||||
if (!id) throw new ErrorBadRequest('id cannot be empty');
|
||||
|
||||
const ids = (typeof id === 'string' || typeof id === 'number') ? [id] : id;
|
||||
|
||||
|
|
Loading…
Reference in New Issue