New release #210
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 { CurrentUserFile } from '../types/file.ts'
|
||||||
import { SigitFile } from './file.ts'
|
import { SigitFile } from './file.ts'
|
||||||
|
|
||||||
@ -63,7 +64,7 @@ export const timeout = (ms: number = 60000) => {
|
|||||||
// Set a timeout using setTimeout
|
// Set a timeout using setTimeout
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
// Reject the promise with an Error indicating a timeout
|
// Reject the promise with an Error indicating a timeout
|
||||||
reject(new Error('Timeout'))
|
reject(new TimeoutError())
|
||||||
}, ms) // Timeout duration in milliseconds
|
}, ms) // Timeout duration in milliseconds
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user