I have the following webscript ( disable-affiliate.put.js
)
var spaceNode = customSpacesService.getAffiliatedSpace(args.id) ;
if(spaceNode == null){
status.code = 404;
status.message = "Can't find affiliated";
status.redirect = true;
}
spaceNode.addAspect ("cnrps:replaceable");
spaceNode.properties["cnrps:motifReplace"] = args.motif;
var affNonValides = customSpacesService.getEntrepotsDesAffiliesSupprimesErrones();
spaceNode.move(affNonValides);
The problem is when the spaceNode
is null, a status template is supposed to be returned as it always do, but an exception is thrown saying Cannot call method "addAspect" of null
So it is obvious that the redirection didn't happen and the script execution go on, Any help please...