mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
feat: Add support for mocking fs
This commit is contained in:
44
src/util/errors/SystemError.ts
Normal file
44
src/util/errors/SystemError.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
* Interface for Node.js System errors
|
||||
*
|
||||
* Node.js generates system errors when exceptions occur within its runtime environment.
|
||||
* These usually occur when an application violates an operating system constraint.
|
||||
* For example, a system error will occur if an application attempts to read a file that does not exist.
|
||||
*/
|
||||
export interface SystemError extends Error {
|
||||
/**
|
||||
* If present, the address to which a network connection failed.
|
||||
*/
|
||||
address?: string;
|
||||
/**
|
||||
* The string error code.
|
||||
* Full list: https://man7.org/linux/man-pages/man3/errno.3.html
|
||||
*/
|
||||
code: string;
|
||||
/**
|
||||
* If present, the file path destination when reporting a file system error.
|
||||
*/
|
||||
dest?: string;
|
||||
/**
|
||||
* The system-provided error number.
|
||||
*/
|
||||
errno: number | string;
|
||||
/**
|
||||
* If present, extra details about the error condition.
|
||||
*/
|
||||
info?: any;
|
||||
/**
|
||||
* If present, the file path when reporting a file system error.
|
||||
*/
|
||||
path?: string;
|
||||
/**
|
||||
* If present, the network connection port that is not available.
|
||||
*/
|
||||
port?: string;
|
||||
/**
|
||||
* The name of the system call that triggered the error.
|
||||
*/
|
||||
syscall: string;
|
||||
}
|
||||
|
||||
export const isSystemError = (error: any): error is SystemError => error.code && error.syscall;
|
||||
Reference in New Issue
Block a user