Skip to content

Commit

Permalink
feat: storage Error 처리 customError 로 처리 #88
Browse files Browse the repository at this point in the history
  • Loading branch information
hyohyo12 committed Nov 13, 2024
1 parent 99377b4 commit 2424402
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
12 changes: 12 additions & 0 deletions backend/src/storage/exception/CloudFunctionsFetchException.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { BaseException } from '../../common/exception/BaseException';
import { HttpStatus } from '@nestjs/common';

export class CloudFunctionsFetchException extends BaseException {
constructor(error: Error) {
super({
code: 777,
message: `cloud function 과 fetch 중 오류가 발생했습니다. : ${error.message}`,
status: HttpStatus.CONFLICT,
});
}
}
3 changes: 2 additions & 1 deletion backend/src/storage/storage.service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Injectable } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { CloudFunctionsFetchException } from './exception/CloudFunctionsFetchException';

@Injectable()
export class StorageService {
Expand All @@ -25,7 +26,7 @@ export class StorageService {
return data;
})
.catch((err) => {
throw new Error(err);
throw new CloudFunctionsFetchException(err);
});
}
}

0 comments on commit 2424402

Please sign in to comment.