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

pull/10295/head
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
1 changed files with 2 additions and 2 deletions

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;