Commit c300975f authored by Diego Iván's avatar Diego Iván
Browse files

agregando try catch

parent 48963cf0
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
import { Injectable } from '@nestjs/common';
import { Injectable, UnauthorizedException } from '@nestjs/common';
import { CreateAdminDto } from './dto/create-admin.dto';
import { Admin } from './entities/admin.entity';
import { Repository } from 'typeorm';
@@ -12,6 +12,10 @@ export class AdminService {
  }

  async findOne(email: string): Promise<Admin> {
    try {
      return await this.adminRepository.findOneByOrFail({ email });
    } catch (error) {
      throw new UnauthorizedException('Admin not found');
    }
  }
}