mirror of
https://github.com/hansputera/tiktok-dl.git
synced 2026-04-05 19:51:57 +02:00
feat(apps.web): add httpErrors
Signed-off-by: Hanif Dwy Putra S <47862061+hansputera@users.noreply.github.com>
This commit is contained in:
23
apps/web/errors/httpError.ts
Normal file
23
apps/web/errors/httpError.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* @class HttpError
|
||||
*/
|
||||
export class HttpError extends Error {
|
||||
public statusCode = 400;
|
||||
/**
|
||||
* @constructor
|
||||
* @param {string} message HttpError message,
|
||||
*/
|
||||
constructor(message: string) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set http status code.
|
||||
* @param {number} code HttpError status code.
|
||||
* @return {HttpError}
|
||||
*/
|
||||
setCode(code: number): HttpError {
|
||||
this.statusCode = code;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
1
apps/web/errors/index.ts
Normal file
1
apps/web/errors/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './httpError';
|
||||
Reference in New Issue
Block a user