fix(errors): add custom timeout error
This commit is contained in:
parent
4d1e672268
commit
9c545a477c
6
src/types/errors/TimeoutError.ts
Normal file
6
src/types/errors/TimeoutError.ts
Normal file
@ -0,0 +1,6 @@
|
||||
export class TimeoutError extends Error {
|
||||
constructor() {
|
||||
super('Timeout')
|
||||
this.name = this.constructor.name
|
||||
}
|
||||
}
|
@ -1,3 +1,4 @@
|
||||
import { TimeoutError } from '../types/errors/TimeoutError.ts'
|
||||
import { CurrentUserFile } from '../types/file.ts'
|
||||
import { SigitFile } from './file.ts'
|
||||
|
||||
@ -63,7 +64,7 @@ export const timeout = (ms: number = 60000) => {
|
||||
// Set a timeout using setTimeout
|
||||
setTimeout(() => {
|
||||
// Reject the promise with an Error indicating a timeout
|
||||
reject(new Error('Timeout'))
|
||||
reject(new TimeoutError())
|
||||
}, ms) // Timeout duration in milliseconds
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user