33 lines
1.3 KiB
JavaScript
33 lines
1.3 KiB
JavaScript
const Fuse = require('fuse-native')
|
|
|
|
module.exports = exports = {
|
|
InvalidReplyUUID: 'INVALID_REPLY_UUID',
|
|
InvalidMessageRoute: 'INVALID_MESSAGE_ROUTE',
|
|
|
|
NodeDoesNotExist: 'NODE_DOES_NOT_EXIST',
|
|
NodeAlreadyExists: 'NODE_ALREADY_EXISTS',
|
|
NodePermissionFail: 'NODE_PERMISSION_FAIL',
|
|
NodeNotEmpty: 'NODE_NOT_EMPTY',
|
|
NotDirectoryDescriptor: 'NOT_DIRECTORY_DESCRIPTOR',
|
|
IsDirectoryDescriptor: 'IS_DIRECTORY_DESCRIPTOR',
|
|
NoSuchDescriptor: 'NO_SUCH_DESCRIPTOR',
|
|
|
|
toCallback(cb, error) {
|
|
if ( error === module.exports.NodeDoesNotExist ) {
|
|
return process.nextTick(cb, Fuse.ENOENT)
|
|
} else if ( error === module.exports.NodeAlreadyExists ) {
|
|
return process.nextTick(cb, Fuse.EEXIST)
|
|
} else if ( error === module.exports.NodePermissionFail ) {
|
|
return process.nextTick(cb, Fuse.EACCES)
|
|
} else if ( error === module.exports.NodeNotEmpty ) {
|
|
return process.nextTick(cb, Fuse.ENOTEMPTY)
|
|
} else if ( error === module.exports.NotDirectoryDescriptor ) {
|
|
return process.nextTick(cb, Fuse.ENOTDIR)
|
|
} else if ( error === module.exports.IsDirectoryDescriptor ) {
|
|
return process.nextTick(cb, Fuse.EISDIR)
|
|
} else {
|
|
return process.nextTick(cb, Fuse.EBADMSG)
|
|
}
|
|
}
|
|
}
|