1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-01-23 18:53:36 +02:00

Server: Improve log quality by increasing specificity of error (#10287)

This commit is contained in:
pedr 2024-04-10 07:40:12 -03:00 committed by GitHub
parent 681d1d67f3
commit 837826ea4f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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;