meilleur gestion des erreur dans sheebr et dans chibrax/kernel.js
This commit is contained in:
@@ -25,13 +25,12 @@ function finit_module(path, params = "", flags = 0) {
|
||||
const fileDescriptor = open(path, modes.O_RDONLY)
|
||||
const result = syscall(SYSCALL_FINIT_MODULE, fileDescriptor, params, flags)
|
||||
if(result > 0) {
|
||||
//parse linux error
|
||||
console.log(errno[result])
|
||||
throw new Error(errno[result])
|
||||
} else {
|
||||
if(result == -1) {
|
||||
console.log('non number or string argument recived')
|
||||
throw new Error('non number or string argument recived')
|
||||
}else if(result == -2) {
|
||||
console.log('unsuported argument length (1-5)')
|
||||
throw new Error('unsuported argument length (1-5)')
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -52,8 +51,7 @@ function modprobe(modulename) {
|
||||
if(fs.existsSync(path.join('/lib/modules', name, 'kernel', modulename))) {
|
||||
finit_module(path.join('/lib/modules', name, 'kernel', modulename))
|
||||
} else {
|
||||
console.log("file not found " + path.join('/lib/modules', name, 'kernel', modulename))
|
||||
//throw "file not found"
|
||||
throw new Error("file not found " + path.join('/lib/modules', name, 'kernel', modulename))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user