Skip to content

Commit a161b4c

Browse files
committed
feat: 🎸 chec response type is valid
1 parent f623efa commit a161b4c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/nfs/v4/server/Nfsv4CompoundProcCtx.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ export class Nfsv4CompoundProcCtx {
8080
if (!fn || !Response) return new msg.Nfsv4CompoundResponse(Nfsv4Stat.NFS4ERR_OP_ILLEGAL, tag, resarray);
8181
EXEC_OP: try {
8282
const opResponse = await fn.call(ops, opReq, this);
83+
if (!(opResponse instanceof Response)) throw new Error('Unexpected response, fn = ' + fn.name);
8384
status = opResponse.status;
8485
resarray.push(opResponse);
8586
} catch (err) {
@@ -101,7 +102,7 @@ export class Nfsv4CompoundProcCtx {
101102
}
102103
status = Nfsv4Stat.NFS4ERR_SERVERFAULT;
103104
this.connection.logger.error(
104-
'Invalid status [code = ' + err + '], using NFS4ERR_SERVERFAULT, [fn = ' + fn.name + ']',
105+
'Invalid status [code = ' + err + ', fn = ' + fn.name + ']',
105106
);
106107
break FIND_STATUS_CODE;
107108
}

0 commit comments

Comments
 (0)