|
|
@@ -1,4 +1,3 @@
|
|
|
-import { HTTPException } from 'hono/http-exception'
|
|
|
import { DataSource } from 'typeorm';
|
|
|
import { UserEntity as User } from './user.entity';
|
|
|
import * as bcrypt from 'bcrypt';
|
|
|
@@ -27,7 +26,7 @@ export class UserService {
|
|
|
return await this.userRepository.save(user);
|
|
|
} catch (error) {
|
|
|
console.error('Error creating user:', error);
|
|
|
- throw new HTTPException(400,{ message: 'Failed to create user', cause: error})
|
|
|
+ throw new Error(`Failed to create user: ${error instanceof Error ? error.message : String(error)}`)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -144,7 +143,7 @@ export class UserService {
|
|
|
return users;
|
|
|
} catch (error) {
|
|
|
console.error('Error getting users:', error);
|
|
|
- throw new HTTPException(500, { message: 'Failed to get users', cause: error })
|
|
|
+ throw new Error(`Failed to get users: ${error instanceof Error ? error.message : String(error)}`)
|
|
|
}
|
|
|
}
|
|
|
|